Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/icc/VERSIONS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2021.2.0
14 changes: 14 additions & 0 deletions build/icc/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ubuntu:16.04

MAINTAINER melpon <[email protected]>

RUN apt-get update && \
apt-get install -y software-properties-common apt-transport-https ca-certificates wget && \
wget -O - https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB 2>/dev/null | apt-key add - && \
add-apt-repository -y "deb https://apt.repos.intel.com/oneapi all main" && \
apt-get update && \
apt-get install -y --no-install-recommends \
g++ \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
33 changes: 33 additions & 0 deletions build/icc/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

. ../init.sh

if [ $# -lt 1 ]; then
echo "$0 <version>"
exit 0
fi

VERSION=$1
PREFIX=/opt/wandbox/icc-$VERSION

# install

# pip3 install dpcpp-cpp-rt==$VERSION
apt-get update

install_package() {
apt-get install -y $1=$(apt list -a $1 2>/dev/null | grep -o "$VERSION-[0-9]*" | head -n 1)
}
# install_package intel-oneapi-ippcp-devel
install_package intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic

rm -r $PREFIX || true
cp -r /opt/intel/oneapi/ $PREFIX || true

cp $BASE_DIR/resources/run-icc.sh.in $PREFIX/run-icc.sh
sed -i "s#@icc_prefix@#$PREFIX#g" $PREFIX/run-icc.sh
chmod +x $PREFIX/run-icc.sh

cp $BASE_DIR/resources/run-icc.sh.in $PREFIX/run-icpc.sh
sed -i "s#@icc_prefix@#$PREFIX#g" $PREFIX/run-icpc.sh
chmod +x $PREFIX/run-icpc.sh
5 changes: 5 additions & 0 deletions build/icc/resources/run-icc.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

. @icc_prefix@/setvars.sh 2>&1 >/dev/null

icc "$@"
5 changes: 5 additions & 0 deletions build/icc/resources/run-icpc.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

. @icc_prefix@/setvars.sh 2>&1 >/dev/null

icpc "$@"
5 changes: 5 additions & 0 deletions build/icc/resources/test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include <stdio.h>

int main(void) {
printf("hello\n");
}
5 changes: 5 additions & 0 deletions build/icc/resources/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include <iostream>

int main() {
std::cout << "hello" << std::endl;
}
16 changes: 16 additions & 0 deletions build/icc/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

. ../init.sh

if [ $# -lt 1 ]; then
echo "$0 <version>"
exit 0
fi

VERSION=$1
PREFIX=/opt/wandbox/icc-$VERSION

$PREFIX/run-icc.sh $BASE_DIR/resources/test.cpp
./a.out > /dev/null
test "`./a.out`" = "hello"
rm a.out
140 changes: 139 additions & 1 deletion cattleshed-conf/compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ def make_boost(self):
gcc_vers = sort_version(get_gcc_versions(includes_gcc_1=False, with_head=True))
clang_vers = sort_version(get_generic_versions('clang', with_head=True))
zapcc_vers = sort_version(get_generic_versions('zapcc', with_head=False))
compiler_vers = [('gcc', v) for v in gcc_vers] + [('clang', v) for v in clang_vers] + [('zapcc', v) for v in zapcc_vers]
icpc_vers = sort_version(get_generic_versions('icc', with_head=False))
compiler_vers = [('gcc', v) for v in gcc_vers] + [('clang', v) for v in clang_vers] + [('zapcc', v) for v in zapcc_vers] + [('icpc', v) for v in icpc_vers]

boost_ver_set = set(get_boost_versions_with_head())
boost_libs = {}
Expand Down Expand Up @@ -1026,6 +1027,141 @@ def make_zapcc(self):

return compilers

def make_icc(self):
icc_vers = sort_version(get_generic_versions('icc', with_head=False), reverse=True)

compilers = []
for cv in icc_vers:
switches = []
initial_checked = []

# default
switches += ['warning', 'optimize', 'cpp-verbose']
initial_checked += ['warning']

# C
switches += ['std-c-default', 'c89', 'gnu89', 'c99', 'gnu99', 'c11', 'c17', 'c18']
initial_checked += [switches[-1]]

# pedantic
switches += ['cpp-no-pedantic', 'cpp-pedantic', 'cpp-pedantic-errors']

# -fansi-escape-codes
ansi_escape_codes = ['-fansi-escape-codes']

# compile-command
compile_command = [
'/opt/wandbox/icc-{cv}/run-icc.sh',
'-oprog.exe',
'-fcolor-diagnostics'
] + ansi_escape_codes + [
'prog.c'
]

display_name = 'icc'
version_command = ['/bin/echo', '{cv}']

compilers.append(format_value({
'name': 'icc-{cv}',
'compile-command': compile_command,
'version-command': version_command,
'display-name': display_name,
'display-compile-command': 'icc prog.c',
'language': 'C',
'output-file': 'prog.c',
'run-command': './prog.exe',
'displayable': True,
'compiler-option-raw': True,
'switches': switches,
'initial-checked': initial_checked,
'jail-name': 'melpon2-default',
'templates': ['icc'],
}, cv=cv))

return compilers

def make_icpc(self):
boost_vers = sort_version(set(a for a, _, _ in get_boost_versions_with_head()))
icpc_vers = sort_version(get_generic_versions('icc', with_head=False), reverse=True)

boost_ver_set = set(get_boost_versions_with_head())
# boost versions
boost_switches = {}
for cv in icpc_vers:
xs = []
for bv in boost_vers:
if (bv, 'icpc', cv) not in boost_ver_set:
continue
xs.append('{bv}'.format(bv=bv))
nothing = ['boost-nothing-icpc-{cv}'.format(cv=cv)]
boost_switches[cv] = nothing + ['boost-{x}-icpc-{cv}'.format(x=x, cv=cv) for x in sort_version(xs)]

compilers = []
for cv in icpc_vers:
switches = []
initial_checked = []

# default
switches += ['warning', 'optimize', 'cpp-verbose']
initial_checked += ['warning']

# boost
if cv in boost_switches:
bs = boost_switches[cv]
switches += bs
initial_checked += [bs[-1]]

# libs
switches += ['sprout', 'msgpack']

# C++
switches += ['std-c++-default', 'c++98', 'gnu++98', 'c++11', 'gnu++11', 'c++14', 'gnu++14', 'c++17', 'gnu++17', 'c++20', 'gnu++20']
initial_checked += [switches[-1]]

# pedantic
switches += ['cpp-no-pedantic', 'cpp-pedantic', 'cpp-pedantic-errors']

# -fansi-escape-codes
ansi_escape_codes = ['-fansi-escape-codes']

# compile-command
compile_command = [
'/opt/wandbox/icc-{cv}/run-icpc.sh',
'-oprog.exe',
'-fcolor-diagnostics'
] + ansi_escape_codes + [
'-lpthread',
'-I/opt/wandbox/boost-sml/include',
'-I/opt/wandbox/boost-di/include',
'-I/opt/wandbox/range-v3/include',
'-I/opt/wandbox/nlohmann-json/include',
'-I/opt/wandbox/cmcstl2/include',
'-I/opt/wandbox/te/include']
compile_command += ['prog.cc']

# head specific
display_name = 'icpc'
version_command = ['/bin/echo', '{cv}']

compilers.append(format_value({
'name': 'icpc-{cv}',
'compile-command': compile_command,
'version-command': version_command,
'display-name': display_name,
'display-compile-command': 'icpc prog.cc',
'language': 'C++',
'output-file': 'prog.cc',
'run-command': './prog.exe',
'displayable': True,
'compiler-option-raw': True,
'switches': switches,
'initial-checked': initial_checked,
'jail-name': 'melpon2-default',
'templates': ['icpc'],
}, cv=cv))

return compilers

def make_mono(self):
mono_vers = sort_version(get_generic_versions('mono', with_head=True), reverse=True)
compilers = []
Expand Down Expand Up @@ -2375,6 +2511,8 @@ def make(self):
self.make_clang_pp() +
self.make_clang() +
self.make_zapcc() +
self.make_icc() +
self.make_icpc() +
self.make_mono() +
self.make_rill() +
self.make_erlang() +
Expand Down
16 changes: 16 additions & 0 deletions cattleshed-conf/templates/icc/prog.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// This file is a "Hello, world!" in C language by gcc for wandbox.
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
puts("Hello, Wandbox!");
return EXIT_SUCCESS;
}

// Intel reference:
// https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/dpc-compiler.html#gs.ztuee0

// C language references:
// https://msdn.microsoft.com/library/fw5abdx6.aspx
// https://www.gnu.org/software/gnu-c-manual/
20 changes: 20 additions & 0 deletions cattleshed-conf/templates/icpc/prog.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This file is a "Hello, world!" in C++ language by Zapcc for wandbox.
#include <iostream>
#include <cstdlib>

int main()
{
std::cout << "Hello, Wandbox!" << std::endl;
}

// Intel reference:
// https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/dpc-compiler.html#gs.ztuee0

// C++ language references:
// https://msdn.microsoft.com/library/3bstk3k5.aspx
// http://www.cplusplus.com/
// https://isocpp.org/
// http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
// http://www.boost.org/doc/
9 changes: 9 additions & 0 deletions test/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,13 @@ def test_boost_head():
add_test(name, lambda: run_boost(version, compiler, 'head', code, '23\n0\nSuccess\n'))


def test_icpc():
code = codecs.open('../build/icc/resources/test.c', 'r', 'utf-8').read()
for cv in get_generic_versions('icc', with_head=False):
compiler = 'icpc-{cv}'.format(cv=cv)
add_test(compiler, lambda compiler=compiler: run(compiler, code, 'hello\n'))


def test_preprocessor():
compiler = 'gcc-head-pp'
code = codecs.open('../build/gcc-head/resources/test.pp', 'r', 'utf-8').read()
Expand Down Expand Up @@ -249,6 +256,8 @@ def register():
test_generic(name='clang', test_file='test.c', expected='hello\n', with_head=True, post_name='-c')
test_generic(name='clang', test_file='test.cpp', expected='hello\n', with_head=True)
test_generic(name='zapcc', test_file='test.cpp', expected='hello\n', with_head=False)
test_generic(name='icc', test_file='test.c', expected='hello\n', with_head=False)
test_icpc()
test_preprocessor()
test_generic(name='mono', test_file='test.cs', expected='hello\n', with_head=True)
test_generic(name='erlang', test_file='prog.erl', expected='hello\n', with_head=True)
Expand Down