diff --git a/.github/docker/ubuntu18.04/c4core-install b/.github/docker/ubuntu18.04/c4core-install index a4138f18..03814a78 100755 --- a/.github/docker/ubuntu18.04/c4core-install +++ b/.github/docker/ubuntu18.04/c4core-install @@ -8,6 +8,7 @@ case $what in $script gcc-all $script clang-all $script embedded + $script intel ;; gcc-all) $script gcc-4.8 @@ -292,6 +293,21 @@ case $what in apt-get install -y \ qemu ;; + intel) + wget -O - https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | apt-key add - + apt-add-repository --yes --no-update "deb https://apt.repos.intel.com/oneapi all main" + apt-get update + # intel-basekit - all basic compilers (C,C++,Fortran,Python) + # intel-hpckit + # intel-iotkit + # intel-aikit + # intel-renderkit + apt-get install -y \ + intel-basekit + # then: + # - for root: `. /opt/intel/oneapi/setvars.sh` + # - for all users: `. ~/intel/oneapi/setvars.sh` + ;; *) ;; esac diff --git a/.github/docker/ubuntu22.04/c4core-install b/.github/docker/ubuntu22.04/c4core-install index 3d2847a4..df7b6c9f 100755 --- a/.github/docker/ubuntu22.04/c4core-install +++ b/.github/docker/ubuntu22.04/c4core-install @@ -8,6 +8,7 @@ case $what in $script gcc-all $script clang-all $script embedded + $script intel ;; gcc-all) $script gcc-4.8 @@ -278,6 +279,21 @@ case $what in apt-get install -y \ qemu ;; + intel) + wget -O - https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | apt-key add - + apt-add-repository --yes --no-update "deb https://apt.repos.intel.com/oneapi all main" + apt-get update + # intel-basekit - all basic compilers (C,C++,Fortran,Python) + # intel-hpckit + # intel-iotkit + # intel-aikit + # intel-renderkit + apt-get install -y \ + intel-basekit + # then: + # - for root: `. /opt/intel/oneapi/setvars.sh` + # - for all users: `. ~/intel/oneapi/setvars.sh` + ;; *) ;; esac diff --git a/.github/reqs.sh b/.github/reqs.sh index b3e786f6..6fb97dbb 100644 --- a/.github/reqs.sh +++ b/.github/reqs.sh @@ -258,6 +258,11 @@ function _c4_gather_compilers() clang++-5.0) _c4_addclang 5.0 ;; clang++-4.0) _c4_addclang 4.0 ;; clang++-3.9) _c4_addclang 3.9 ;; + arm*) ;; + icc) _c4_add_intelcxx ;; + icx) _c4_add_intelcxx ;; + icpc) _c4_add_intelcxx ;; + icpx) _c4_add_intelcxx ;; all) for ver in 11 10 9 8 7 6 5 4.9 4.8 ; do all="$all g++-$ver" @@ -276,8 +281,6 @@ function _c4_gather_compilers() "") # use default compiler ;; - arm*) - ;; *) echo "unknown compiler: $cxx" exit 1 @@ -375,6 +378,35 @@ function _c4_addlibcxx() #_add_apt libc++-dev:i386 } +# add the intel compiler +function _c4_add_intelcxx() +{ + # https://www.scivision.dev/intel-oneapi-github-actions/ + # https://neelravi.com/post/intel-oneapi-install/ + + # add the key and the apt source + wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + + # this is required for 32 bit https://askubuntu.com/questions/1057341/unable-to-find-stl-headers-in-ubuntu-18-04 + _add_apt g++-multilib + + #_add_apt intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic + _add_apt intel-basekit # all basic compilers + _add_apt intel-basekit-32bit # all basic compilers + #_add_apt intel-hpckit # HPC toolkits + #_add_apt intel-iotkit # IoT toolkits + #_add_apt intel-aikit # AI analytics toolkit + #_add_apt intel-dlfdkit # Deep learning framework + #_add_apt intel-renderkit # Rendering toolkit + + # NOTE after installation: + # . /opt/intel/oneapi/setvars.sh (root access) + # . ~/intel/oneapi/setvars.sh (single user) +} + #------------------------------------------------------------------------------- @@ -393,7 +425,9 @@ function _add_apt() sourceslist=$2 APT_PKG="$APT_PKG $pkgs" echo "adding to apt packages: $pkgs" - _add_src "$pkgs" "$sourceslist" + if [ ! -z "$sourceslist" ] ; then + _add_src "$sourceslist" "# for packages: $pkgs" + fi } # add an apt source diff --git a/.github/setenv.sh b/.github/setenv.sh index 185a65aa..e889449d 100644 --- a/.github/setenv.sh +++ b/.github/setenv.sh @@ -5,6 +5,7 @@ set -x PROJ_DIR=$(pwd) + function c4_show_info() { set +x @@ -49,6 +50,10 @@ function c4_show_info() echo "number of cores=$(nproc)" $CXX_ --version ;; + icpx|icpc|icx|icc) + echo "number of cores=$(nproc)" + ( source /opt/intel/oneapi/setvars.sh ; $CXX_ --version ) + ;; esac set -x git branch @@ -341,8 +346,8 @@ function c4_cfg_test() -DCMAKE_BUILD_TYPE=$BT $CMFLAGS \ -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" ;; - *g++*|*gcc*|*clang*) - export CC_=$(echo "$CXX_" | sed 's:clang++:clang:g' | sed 's:g++:gcc:g') + *g++*|*gcc*|*clang*|icpx|icpc) + export CC_=$(echo "$CXX_" | sed 's:clang++:clang:g' | sed 's:g++:gcc:g' | sed 's:icpx:icx:g' | sed 's:icpc:icc:g') _c4_choose_clang_tidy $CXX_ cmake -S $PROJ_DIR -B $build_dir -DCMAKE_INSTALL_PREFIX="$install_dir" \ -DCMAKE_C_COMPILER=$CC_ -DCMAKE_CXX_COMPILER=$CXX_ \ @@ -439,7 +444,7 @@ function _c4_parallel_build_flags() echo "-IDEBuildOperationMaxNumberOfConcurrentCompileTasks=$NUM_JOBS_BUILD" fi ;; - *g++*|*gcc*|*clang*|em++) + *g++*|*gcc*|*clang*|em++|icpx|icpc|icx|icc) if [ -z "$NUM_JOBS_BUILD" ] ; then echo "-j $(nproc)" else @@ -466,7 +471,7 @@ function _c4_generator_build_flags() # https://stackoverflow.com/questions/51153525/xcode-10-unable-to-attach-db-error echo "-UseModernBuildSystem=NO" ;; - *g++*|*gcc*|*clang*|em++) + *g++*|*gcc*|*clang*|em++|icpx|icpc|icx|icc) ;; "") # allow empty compiler ;; diff --git a/.github/workflows/intel.yml b/.github/workflows/intel.yml new file mode 100644 index 00000000..1f20db44 --- /dev/null +++ b/.github/workflows/intel.yml @@ -0,0 +1,72 @@ +name: intel + +defaults: + #if: "!contains(github.event.head_commit.message, 'skip ci')" # SKIP + run: + # Use a bash shell so we can use the same syntax for environment variable + # access regardless of the host operating system + shell: bash -e -x {0} + +on: + # https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662 + workflow_dispatch: + push: + branches: + - master + pull_request: + branches: + - master + +env: + PROJ_PFX_TARGET: c4core- + PROJ_PFX_CMAKE: C4CORE_ + CMAKE_FLAGS: + NUM_JOBS_BUILD: # 4 + + +jobs: + + #---------------------------------------------------------------------------- + intel: + name: intel/c++${{matrix.std}}/${{matrix.bt}} + continue-on-error: true + if: always() # https://stackoverflow.com/questions/62045967/github-actions-is-there-a-way-to-continue-on-error-while-still-getting-correct + runs-on: ubuntu-latest + container: ghcr.io/biojppm/c4core/ubuntu18.04:latest # use the docker image + strategy: + fail-fast: false + matrix: + include: + - {std: 11, cxx: icpx, bt: Debug , bitlinks: shared64 static32} + - {std: 11, cxx: icpx, bt: Release, bitlinks: shared64 static32} + - {std: 17, cxx: icpx, bt: Debug , bitlinks: shared64 static32} + - {std: 17, cxx: icpx, bt: Release, bitlinks: shared64 static32} + - {std: 20, cxx: icpx, bt: Debug , bitlinks: shared64 static32} + - {std: 20, cxx: icpx, bt: Release, bitlinks: shared64 static32} + env: {STD: "${{matrix.std}}", CXX_: "${{matrix.cxx}}", BT: "${{matrix.bt}}", BITLINKS: "${{matrix.bitlinks}}", VG: "${{matrix.vg}}", SAN: "${{matrix.san}}", LINT: "${{matrix.lint}}", OS: "${{matrix.os}}"} + steps: + - {name: checkout, uses: actions/checkout@v3, with: {submodules: recursive}} + - {name: checkout, uses: actions/checkout@v3, with: {submodules: recursive}} + - run: git config --system --add safe.directory '*' # needed for running in the docker image. see https://github.com/actions/checkout/issues/1169 + - run: c4core-install intel + - {name: show info, run: source .github/setenv.sh && c4_show_info} + - name: shared64-configure--------------------------------------------------- + run: source /opt/intel/oneapi/setvars.sh intel64 && source .github/setenv.sh && c4_cfg_test shared64 + - {name: shared64-build, run: source /opt/intel/oneapi/setvars.sh intel64 && source .github/setenv.sh && c4_build_test shared64} + - {name: shared64-run, run: source /opt/intel/oneapi/setvars.sh intel64 && source .github/setenv.sh && c4_run_test shared64} + - {name: shared64-pack, run: source /opt/intel/oneapi/setvars.sh intel64 && source .github/setenv.sh && c4_package shared64} + - name: static64-configure--------------------------------------------------- + run: source /opt/intel/oneapi/setvars.sh intel64 && source .github/setenv.sh && c4_cfg_test static64 + - {name: static64-build, run: source /opt/intel/oneapi/setvars.sh intel64 && source .github/setenv.sh && c4_build_test static64} + - {name: static64-run, run: source /opt/intel/oneapi/setvars.sh intel64 && source .github/setenv.sh && c4_run_test static64} + - {name: static64-pack, run: source /opt/intel/oneapi/setvars.sh intel64 && source .github/setenv.sh && c4_package static64} + - name: static32-configure--------------------------------------------------- + run: source /opt/intel/oneapi/setvars.sh intel32 && source .github/setenv.sh && c4_cfg_test static32 + - {name: static32-build, run: source /opt/intel/oneapi/setvars.sh intel32 && source .github/setenv.sh && c4_build_test static32} + - {name: static32-run, run: source /opt/intel/oneapi/setvars.sh intel32 && source .github/setenv.sh && c4_run_test static32} + - {name: static32-pack, run: source /opt/intel/oneapi/setvars.sh intel32 && source .github/setenv.sh && c4_package static32} + - name: shared32-configure--------------------------------------------------- + run: source /opt/intel/oneapi/setvars.sh intel32 && source .github/setenv.sh && c4_cfg_test shared32 + - {name: shared32-build, run: source /opt/intel/oneapi/setvars.sh intel32 && source .github/setenv.sh && c4_build_test shared32} + - {name: shared32-run, run: source /opt/intel/oneapi/setvars.sh intel32 && source .github/setenv.sh && c4_run_test shared32} + - {name: shared32-pack, run: source /opt/intel/oneapi/setvars.sh intel32 && source .github/setenv.sh && c4_package shared32}