diff --git a/bsc/alya/default.nix b/bsc/alya/default.nix new file mode 100644 index 0000000..8781068 --- /dev/null +++ b/bsc/alya/default.nix @@ -0,0 +1,40 @@ +{ + stdenv +, cmake +, ifort +, impi +, pkgconfig +, icc +}: + +stdenv.mkDerivation rec { + pname = "alya"; + version = "${src.shortRev}"; + src = builtins.fetchGit { + url = "ssh://git@alya.gitlab.bsc.es/alya/alya.git"; + ref = "master"; + rev = "d7bd220b4ecf70f745c9c3667b4e830a6b3e76dc"; + }; + buildInputs = [ cmake ifort impi pkgconfig icc ]; + cmakeFlags = [ + #"--debug-trycompile" + #"--debug-find" + "-DUSEMPIF08=ON" + "-DCMAKE_C_COMPILER=icc" + "-DCMAKE_CXX_COMPILER=icpc" + "-DCMAKE_Fortran_COMPILER=ifort" + "-DMPI_HOME=${impi}" + #"-DMPI_C_COMPILER=mpicc" + #"-DMPI_CXX_COMPILER=mpicxx" + #"-DWITH_ALL_MODULES=OFF" "-DWITH_MODULE_NASTIN=ON" + "-DWITH_NDIMEPAR=ON" + #"-DWITH_CTEST=OFF" + "-DINTEGER_SIZE=8" + ]; + #I_MPI_ROOT = impi; + #VERBOSE = 1; + #NIX_DEBUG = 5; + enableParallelBuilding = true; + dontStrip = true; + hardeningDisable = [ "all" ]; +} diff --git a/bsc/intel-compiler/default.nix b/bsc/intel-compiler/default.nix index 9b60dcf..5f3f76d 100644 --- a/bsc/intel-compiler/default.nix +++ b/bsc/intel-compiler/default.nix @@ -25,8 +25,16 @@ in wrapCCWith rec { >> $out/nix-support/setup-hook # Create the wrappers for icc and icpc - wrap icc $wrapper $ccPath/icc - wrap icpc $wrapper $ccPath/icpc - wrap ifort $wrapper $ccPath/ifort + if [ -e $ccPath/icc ]; then + wrap icc $wrapper $ccPath/icc + fi + + if [ -e $ccPath/icpc ]; then + wrap icpc $wrapper $ccPath/icpc + fi + + if [ -e $ccPath/ifort ]; then + wrap ifort $wrapper $ccPath/ifort + fi ''; } diff --git a/bsc/intel-compiler/icc2021.nix b/bsc/intel-compiler/icc2021.nix index b8f275a..076da54 100644 --- a/bsc/intel-compiler/icc2021.nix +++ b/bsc/intel-compiler/icc2021.nix @@ -114,7 +114,7 @@ in ''; # FIXME: Some dependencies are missing - autoPatchelfIgnoreMissingDeps=true; + autoPatchelfIgnoreMissingDeps = true; #autoPatchelfIgnoreMissingDeps = [ "*" ]; # Compiler diff --git a/bsc/intel-compiler/wrapper-fortran.nix b/bsc/intel-compiler/wrapper-fortran.nix new file mode 100644 index 0000000..17ccdf8 --- /dev/null +++ b/bsc/intel-compiler/wrapper-fortran.nix @@ -0,0 +1,29 @@ +{ + stdenv +, gcc +, iccUnwrapped +, wrapCCWith +}: + +let + targetConfig = stdenv.targetPlatform.config; + inherit gcc; +in wrapCCWith rec { + cc = iccUnwrapped; + extraBuildCommands = '' + echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-cflags + echo "-isystem ${iccUnwrapped}/include" >> $out/nix-support/cc-cflags + echo "-isystem ${iccUnwrapped}/include/icc" >> $out/nix-support/cc-cflags + echo "-isystem ${gcc.cc}/include/c++/${gcc.version}" >> $out/nix-support/cc-cflags + echo "-isystem ${gcc.cc}/include/c++/${gcc.version}/${targetConfig}" >> $out/nix-support/cc-cflags + + echo "-L${iccUnwrapped}/lib" >> $out/nix-support/cc-ldflags + echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-ldflags + echo "-L${gcc.cc.lib}/lib" >> $out/nix-support/cc-ldflags + + # Create the wrappers for icx* + wrap lld $wrapper $ccPath/lld + wrap icx $wrapper $ccPath/icx + wrap icpx $wrapper $ccPath/icpx + ''; +} diff --git a/bsc/intel-oneapi/2022.3.1.nix b/bsc/intel-oneapi/2022.3.1.nix new file mode 100644 index 0000000..76ea008 --- /dev/null +++ b/bsc/intel-oneapi/2022.3.1.nix @@ -0,0 +1,219 @@ +{ stdenv +, fetchurl +, ncurses +, lib +, dpkg +, rsync +, libffi +, libelf +, libxml2 +, hwloc +, autoPatchelfHook +}: + +# The distribution of intel packages is a mess. We are doing the installation +# based on the .deb metapackage "intel-hpckit", and follow de dependencies, +# which have mismatching versions. + +# Bruno Bzeznik (bzizou) went through the madness of using their .sh installer, +# pulling all the X dependencies here: +# https://github.com/Gricad/nur-packages/blob/4b67c8ad0ce1baa1d2f53ba41ae5bca8e00a9a63/pkgs/intel/oneapi.nix + +# But this is an attempt to install the packages from the APT repo + +let + + # Composite based on hpckit + hpckit = { ver = "2022.2.0"; rev = "191"; }; + #basekit = { ver = "2022.2.0"; rev = "262"; }; + comp = { ver = "2022.0.2"; rev = "3658"; }; + mpi = { ver = "2021.6.0"; rev = "602"; }; + + compilerRev = "3768"; + mpiRev = "76"; + debList = [ + "intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-${v}-${v}-${compilerRev}_amd64.deb" + "intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-runtime-${v}-${v}-${compilerRev}_amd64.deb" + "intel-oneapi-compiler-fortran-common-${v}-${v}-${compilerRev}_all.deb" + "intel-oneapi-compiler-shared-${v}-${v}-${compilerRev}_amd64.deb" + "intel-oneapi-compiler-cpp-eclipse-cfg-${v}-${compilerRev}_all.deb" + "intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-common-${v}-${v}-${compilerRev}_all.deb" + "intel-oneapi-compiler-dpcpp-cpp-classic-fortran-shared-runtime-${v}-${v}-${compilerRev}_amd64.deb" + "intel-oneapi-compiler-dpcpp-cpp-common-${v}-${v}-${compilerRev}_all.deb" + "intel-oneapi-compiler-fortran-runtime-${v}-${v}-${compilerRev}_amd64.deb" + "intel-oneapi-compiler-shared-common-${v}-${v}-${compilerRev}_all.deb" + "intel-oneapi-compiler-shared-runtime-${v}-${v}-${compilerRev}_amd64.deb" + + "intel-oneapi-dpcpp-cpp-${v}-${v}-${compilerRev}_amd64.deb" + "intel-oneapi-openmp-${v}-${v}-${compilerRev}_amd64.deb" + "intel-oneapi-openmp-common-${v}-${v}-${compilerRev}_all.deb" + + "intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-${v}-${compilerRev}_amd64.deb" + "intel-oneapi-compiler-dpcpp-cpp-runtime-${v}-${v}-${compilerRev}_amd64.deb" + "intel-oneapi-compiler-dpcpp-eclipse-cfg-${v}-${compilerRev}_all.deb" + "intel-oneapi-compiler-dpcpp-cpp-${v}-${v}-${compilerRev}_amd64.deb" + "intel-oneapi-compiler-fortran-${v}-${v}-${compilerRev}_amd64.deb" + "intel-oneapi-compiler-fortran-runtime-${v}-${compilerRev}_amd64.deb" + + "intel-oneapi-mpi-devel-${mpi.ver}-${mpi.ver}-${mpi.rev}_amd64.deb" + "intel-oneapi-mpi-${mpi.ver}-${mpi.ver}-${mpi.rev}_amd64.deb" + + #"intel-oneapi-tbb-${v}-${v}-${tbbVer}_amd64.deb" + #"intel-oneapi-tbb-devel-${v}-${v}-${tbbVer}_amd64.deb" + #"intel-oneapi-tbb-common-${v}-${v}-${tbbVer}_all.deb" + #"intel-oneapi-tbb-common-devel-${v}-${v}-${tbbVer}_all.deb" + + #intel-basekit-2021.1.0 + #intel-hpckit-getting-started (>= 2021.1.0-2684) + #intel-oneapi-common-vars (>= 2021.1.1-60) + #intel-oneapi-common-licensing-2021.1.1 + #intel-oneapi-dev-utilities-2021.1.1 + #intel-oneapi-inspector (>= 2021.1.1-42) + #intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2021.1.1 + #intel-oneapi-compiler-fortran-2021.1.1 + #intel-oneapi-clck-2021.1.1 + #intel-oneapi-itac-2021.1.1 + ]; + + pkgsDesc = stdenv.mkDerivation { + name = "intel-oneapi-packages"; + srcs = [ + (fetchurl { + url = "https://apt.repos.intel.com/oneapi/dists/all/main/binary-amd64/Packages"; + sha256 = "sha256-swUGn097D5o1giK2l+3H4xFcUXSAUYtavQsPyiJlr2A="; + }) + (fetchurl { + url = "https://apt.repos.intel.com/oneapi/dists/all/main/binary-all/Packages"; + sha256 = "sha256-Ewpy0l0fXiJDG0FkAGykqizW1bm+/lcvI2OREyqzOLM="; + }) + ]; + phases = [ "installPhase" ]; + installPhase = '' + awk -F': ' '\ + BEGIN { print "[ {" } \ + NR>1 && /^Package: / { print "} {"; } \ + /: / { printf "%s = \"%s\";\n", $1, $2 } \ + END { print "} ]" }' $srcs > $out + ''; + }; + + pkgsExpanded = import pkgsDesc; + + getSum = pkgs: deb: + let + matches = lib.filter (x: "pool/main/${deb}" == x.Filename) pkgs; + match = assert lib.length matches == 1; lib.elemAt matches 0; + #match = lib.elemAt matches 0; + in + match.SHA256; + + apthost = "https://apt.repos.intel.com/oneapi/pool/main/"; + urls = builtins.map (x: apthost + x) debList; + sums = builtins.map (x: getSum pkgsExpanded x) debList; + getsrc = url: sha256: fetchurl { inherit url sha256; }; + + intel-oneapi-source = stdenv.mkDerivation rec { + version = v; + pname = "intel-oneapi-source"; + + srcs = lib.zipListsWith getsrc urls sums; + dontBuild = true; + dontStrip = true; + buildInputs = [ dpkg ]; + phases = [ "unpackPhase" "installPhase" ]; + + unpackCmd = '' + dpkg -x $curSrc . + ''; + + installPhase = '' + mkdir -p $out + mv intel $out + ''; + }; + +in + stdenv.mkDerivation rec { + version = v; + pname = "intel-oneapi"; + src = intel-oneapi-source; + + buildInputs = [ + rsync + libffi + libelf + libxml2 + hwloc + stdenv.cc.cc.lib + ]; + nativeBuildInputs = [ autoPatchelfHook ]; + + # The gcc package is required for building other programs + #propagatedBuildInputs = [ gcc ]; + + phases = [ "installPhase" "fixupPhase" ]; + + dontStrip = true; + + installPhase = '' + mkdir -p $out/{bin,lib,include} + mkdir -p $out/share/man + + cd $src + + # Compiler + pushd intel/oneapi/compiler/${version} + pushd linux + # Binaries + rsync -a bin/ $out/bin/ + rsync -a bin/intel64/ $out/bin/ + rsync -a bin-llvm/ $out/bin-llvm/ + + # Libraries + rsync -a --exclude=oclfpga lib/ $out/lib/ + rsync -a compiler/lib/intel64_lin/ $out/lib/ + + # Headers + rsync -a include/ $out/include/ + rsync -a compiler/include/ $out/include/ + popd + + # Manuals + rsync -a documentation/en/man/common/ $out/share/man/ + popd + ''; + + } + + + + + + +#in +# +#stdenv.mkDerivation rec { +# version = "2022.3.2"; +# pkgVersion = "2022.3.1.16997"; # Intel (R) Versioning ??? +# pname = "intel-onapi-hpc-toolkit"; +# +# # From their CI: https://github.com/oneapi-src/oneapi-ci/blob/master/.github/workflows/build_all.yml +# src = fetchurl { +# url = "https://registrationcenter-download.intel.com/akdlm/irc_nas/18975/l_HPCKit_p_${pkgVersion}_offline.sh"; +# sha256 = "sha256-04TYMArgro1i+ONdiNZejripMNneUPS7Gj+MSfoGfWI="; +# }; +# +# buildInputs = [ ncurses debs ]; +# +# unpackPhase = '' +# sh $src -x +# #sourceRoot=l_HPCKit_p_${pkgVersion}_offline +# ''; +# +# # The gcc package is required for building other programs +# #propagatedBuildInputs = [ gcc ]; +# +# installPhase = '' +# mv l_HPCKit_p_${pkgVersion}_offline $out +# ''; +#} diff --git a/bsc/intel-oneapi/default.nix b/bsc/intel-oneapi/default.nix new file mode 100644 index 0000000..17296ad --- /dev/null +++ b/bsc/intel-oneapi/default.nix @@ -0,0 +1,33 @@ +{ + stdenv +, gcc +, nanos6 +, iccUnwrapped +, wrapCCWith +, intelLicense +}: + +let + targetConfig = stdenv.targetPlatform.config; + inherit gcc; +in wrapCCWith rec { + cc = iccUnwrapped; + extraBuildCommands = '' + echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-cflags + echo "-isystem ${iccUnwrapped}/include" >> $out/nix-support/cc-cflags + echo "-isystem ${iccUnwrapped}/include/intel64" >> $out/nix-support/cc-cflags + echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-ldflags + echo "-L${gcc.cc.lib}/lib" >> $out/nix-support/cc-ldflags + + cat "${iccUnwrapped}/nix-support/propagated-build-inputs" >> \ + $out/nix-support/propagated-build-inputs + + echo "export INTEL_LICENSE_FILE=${intelLicense}" \ + >> $out/nix-support/setup-hook + + # Create the wrappers for icc and icpc + wrap icc $wrapper $ccPath/icc + wrap icpc $wrapper $ccPath/icpc + wrap ifort $wrapper $ccPath/ifort + ''; +} diff --git a/bsc/intel-oneapi/ifort.nix b/bsc/intel-oneapi/ifort.nix new file mode 100644 index 0000000..d9879f1 --- /dev/null +++ b/bsc/intel-oneapi/ifort.nix @@ -0,0 +1,383 @@ +{ stdenv +, fetchurl +, ncurses +, lib +, dpkg +, rsync +, libffi +, libelf +, libxml2 +, hwloc +, zlib +, autoPatchelfHook +, symlinkJoin +, libfabric +, gcc +, wrapCCWith +}: + +# The distribution of intel packages is a mess. We are doing the installation +# based on the .deb metapackage "intel-hpckit", and follow de dependencies, +# which have mismatching versions. + +# Bruno Bzeznik (bzizou) went through the madness of using their .sh installer, +# pulling all the X dependencies here: +# https://github.com/Gricad/nur-packages/blob/4b67c8ad0ce1baa1d2f53ba41ae5bca8e00a9a63/pkgs/intel/oneapi.nix + +# But this is an attempt to install the packages from the APT repo + +let + + # As of 2022-11-10 this is the last release for hpckit and all other + # components + v = { + hpckit = "2022.3.0"; + compiler = "2022.2.0"; + tbb = "2021.7.1"; + mpi = "2021.7.0"; + }; + + aptPackageIndex = stdenv.mkDerivation { + name = "intel-oneapi-packages"; + srcs = [ + (fetchurl { + url = "https://apt.repos.intel.com/oneapi/dists/all/main/binary-amd64/Packages"; + sha256 = "sha256-swUGn097D5o1giK2l+3H4xFcUXSAUYtavQsPyiJlr2A="; + }) + (fetchurl { + url = "https://apt.repos.intel.com/oneapi/dists/all/main/binary-all/Packages"; + sha256 = "sha256-Ewpy0l0fXiJDG0FkAGykqizW1bm+/lcvI2OREyqzOLM="; + }) + ]; + phases = [ "installPhase" ]; + installPhase = '' + awk -F': ' '\ + BEGIN { print "[ {" } \ + NR>1 && /^Package: / { print "} {"; } \ + /: / { printf "%s = \"%s\";\n", $1, $2 } \ + END { print "} ]" }' $srcs > $out + ''; + }; + + aptPackages = import aptPackageIndex; + + apthost = "https://apt.repos.intel.com/oneapi/"; + + getSum = pkgList: name: + let + matches = lib.filter (x: name == x.Package) pkgList; + #n = lib.length matches; + #match = builtins.trace (name + " -- ${builtins.toString n}") (lib.elemAt matches 0); + match = lib.elemAt matches 0; + in + match.SHA256; + + getUrl = pkgList: name: + let + matches = lib.filter (x: name == x.Package) pkgList; + match = assert lib.length matches == 1; lib.elemAt matches 0; + #n = lib.length matches; + #match = builtins.trace (name + " -- ${builtins.toString n}") (lib.elemAt matches 0); + in + apthost + match.Filename; + + uncompressDebs = debs: name: stdenv.mkDerivation { + name = name; + srcs = debs; + buildInputs = [ dpkg ]; + phases = [ "installPhase" ]; + installPhase = '' + mkdir -p $out + for src in $srcs; do + echo "unpacking $src" + dpkg -x $src $out + done + ''; + }; + + joinDebs = name: names: + let + urls = builtins.map (x: getUrl aptPackages x) names; + sums = builtins.map (x: getSum aptPackages x) names; + getsrc = url: sha256: fetchurl { inherit url sha256; }; + debs = lib.zipListsWith getsrc urls sums; + in + uncompressDebs debs "${name}-source"; + + + intel-mpi = stdenv.mkDerivation rec { + version = v.mpi; + pname = "intel-mpi"; + + src = joinDebs pname [ + "intel-oneapi-mpi-devel-${version}" + "intel-oneapi-mpi-${version}" + ]; + + buildInputs = [ + rsync + libfabric + zlib + stdenv.cc.cc.lib + ]; + + nativeBuildInputs = [ autoPatchelfHook ]; + phases = [ "installPhase" "fixupPhase" ]; + dontStrip = true; + installPhase = '' + mkdir -p $out/{bin,etc,lib,include} + mkdir -p $out/share/man + + cd $src + + # MPI + pushd opt/intel/oneapi/mpi/${version} + rsync -a man/ $out/share/man/ + rsync -a etc/ $out/etc/ + rsync -a include/ $out/include/ + rsync -a lib/ $out/lib/ + # Broken due missing libze_loader.so.1 + rsync -a --exclude IMB-MPI1-GPU bin/ $out/bin/ + popd + ''; + }; + + intel-tbb = stdenv.mkDerivation rec { + version = v.tbb; + pname = "intel-tbb"; + src = joinDebs pname [ + "intel-oneapi-tbb-${version}" + "intel-oneapi-tbb-common-${version}" + ]; + + buildInputs = [ + intel-mpi + rsync + libffi + libelf + libxml2 + hwloc + stdenv.cc.cc.lib + ]; + + nativeBuildInputs = [ autoPatchelfHook ]; + phases = [ "installPhase" "fixupPhase" ]; + dontStrip = true; + + autoPatchelfIgnoreMissingDeps = [ "libhwloc.so.5" ]; + + installPhase = '' + mkdir -p $out/lib + + cd $src + + pushd opt/intel/oneapi/tbb/${version} + # Libraries + rsync -a lib/intel64/gcc4.8/ $out/lib/ + popd + ''; + }; + + intel-compiler-shared = stdenv.mkDerivation rec { + version = v.compiler; + pname = "intel-compiler-shared"; + src = joinDebs pname [ + "intel-oneapi-compiler-shared-${version}" + "intel-oneapi-compiler-shared-common-${version}" + "intel-oneapi-compiler-shared-runtime-${version}" + ]; + + buildInputs = [ + intel-mpi + intel-tbb + rsync + libffi + libelf + libxml2 + hwloc + stdenv.cc.cc.lib + ]; + + nativeBuildInputs = [ autoPatchelfHook ]; + phases = [ "installPhase" "fixupPhase" ]; + dontStrip = true; + + autoPatchelfIgnoreMissingDeps = [ "libsycl.so.5" ]; + + installPhase = '' + mkdir -p $out/{bin,lib,include} + mkdir -p $out/share/man + + cd $src + + # Compiler + pushd opt/intel/oneapi/compiler/${version} + pushd linux + # Binaries + rsync -a bin/ $out/bin/ + rsync -a --exclude libcilkrts.so.5 bin/intel64/ $out/bin/ + + # Libraries + rsync -a lib/ $out/lib/ + rsync -a compiler/lib/intel64_lin/ $out/lib/ + chmod +w $out/lib + cp bin/intel64/libcilkrts.so.5 $out/lib/ + ln -s $out/lib/libcilkrts.so.5 $out/lib/libcilkrts.so + + # Headers + rsync -a compiler/include/ $out/include/ + popd + popd + ''; + }; + + + intel-compiler-fortran = stdenv.mkDerivation rec { + version = v.compiler; + pname = "intel-fortran"; + src = joinDebs pname [ + "intel-oneapi-compiler-fortran-${version}" + "intel-oneapi-compiler-fortran-common-${version}" + "intel-oneapi-compiler-fortran-runtime-${version}" + + "intel-oneapi-compiler-dpcpp-cpp-classic-fortran-shared-runtime-${version}" + #"intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-${version}" + #"intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-runtime-${version}" + ]; + + buildInputs = [ + intel-mpi + intel-compiler-shared + rsync + libffi + libelf + libxml2 + hwloc + stdenv.cc.cc.lib + ]; + + nativeBuildInputs = [ autoPatchelfHook ]; + + # The gcc package is required for building other programs + propagatedBuildInputs = [ stdenv.cc intel-compiler-shared ]; + + phases = [ "installPhase" "fixupPhase" ]; + + dontStrip = true; + + installPhase = '' + mkdir -p $out/{bin,lib,include} + mkdir -p $out/share/man + + cd $src + + # Compiler + pushd opt/intel/oneapi/compiler/${version} + pushd linux + # Binaries + rsync -a bin/ $out/bin/ + rsync -a bin/intel64/ $out/bin/ + + # Libraries + rsync -a lib/ $out/lib/ + rsync -a compiler/lib/intel64_lin/ $out/lib/ + + # Headers + rsync -a compiler/include/ $out/include/ + popd + + # Manuals + rsync -a documentation/en/man/common/ $out/share/man/ + + # Fix lib_lin + ln -s $out/lib $out/lib_lin + popd + ''; + }; + + + intel-compiler-classic = stdenv.mkDerivation rec { + version = v.compiler; + pname = "intel-compiler-classic"; + src = joinDebs pname [ + "intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-${version}" + "intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-runtime-${version}" + "intel-oneapi-compiler-dpcpp-cpp-classic-fortran-shared-runtime-${version}" + "intel-oneapi-dpcpp-cpp-${version}" + "intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-common-${version}" + ]; + + buildInputs = [ + intel-compiler-shared + rsync + libffi + libelf + libxml2 + hwloc + stdenv.cc.cc.lib + ]; + + nativeBuildInputs = [ autoPatchelfHook ]; + + # The gcc package is required for building other programs + propagatedBuildInputs = [ stdenv.cc intel-compiler-shared ]; + + phases = [ "installPhase" "fixupPhase" ]; + + dontStrip = true; + + installPhase = '' + mkdir -p $out/{bin,lib} + mkdir -p $out/share/man + + cd $src + + # Compiler + pushd opt/intel/oneapi/compiler/${version} + pushd linux + # Binaries + rsync -a bin/ $out/bin/ + rsync -a bin/intel64/ $out/bin/ + + # Libraries + rsync -a --exclude oclfpga lib/ $out/lib/ + popd + + # Manuals + rsync -a documentation/en/man/common/ $out/share/man/ + popd + ''; + }; + + intel-compiler-classic-wrapper = + let + targetConfig = stdenv.targetPlatform.config; + inherit gcc; + in wrapCCWith rec { + cc = intel-compiler-classic; + extraBuildCommands = '' + echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-cflags + echo "-isystem ${cc}/include" >> $out/nix-support/cc-cflags + echo "-isystem ${cc}/include/intel64" >> $out/nix-support/cc-cflags + echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-ldflags + echo "-L${gcc.cc.lib}/lib" >> $out/nix-support/cc-ldflags + echo "-L${intel-compiler-shared}/lib" >> $out/nix-support/cc-ldflags + + cat "${cc}/nix-support/propagated-build-inputs" >> \ + $out/nix-support/propagated-build-inputs + + # Create the wrappers for icc and icpc + wrap icc $wrapper $ccPath/icc + wrap icpc $wrapper $ccPath/icpc + wrap mcpcom $wrapper $ccPath/mcpcom + ''; + }; + +in + { + inherit + intel-compiler-classic + intel-compiler-classic-wrapper + intel-compiler-fortran + intel-compiler-shared; + } diff --git a/bsc/intel-oneapi/license.nix b/bsc/intel-oneapi/license.nix new file mode 100644 index 0000000..710dab1 --- /dev/null +++ b/bsc/intel-oneapi/license.nix @@ -0,0 +1,39 @@ +{ stdenv +, requireFile +}: + +stdenv.mkDerivation rec { + name = "intel-compiler-license"; + version = "2019.7.217"; + + src = requireFile { + name = "license.lic"; + sha256 = "0rgmsqkhpqcfny8j7msa4sgz3prhh248ylh69gjh12dkra77prsj"; + message = '' + The Intel Compiler requires a license. You can get one (free of charge) if + you meet the requeriments at the website: + + https://software.intel.com/content/www/us/en/develop/articles/qualify-for-free-software.html#opensourcecontributor + + Or you can use your own license. Add it to the store with: + + $ nix-store --add-fixed sha256 license.lic + /nix/store/2p9v0nvsl3scshjx348z6j32rh7ac0db-license.lic + + Notice that the name must match exactly "license.lic". + + Then update the hash in the bsc/intel-compiler/license.nix file using the + nix-hash command with: + + $ nix-hash --type sha256 --base32 --flat /nix/store/2p9v0nvsl3scshjx348z6j32rh7ac0db-license.lic + 06g2xgm1lch6zqfkhb768wacdx46kf61mfvj5wfpyssw0anr0x9q + ''; + }; + + dontUnpack = true; + + installPhase = '' + mkdir -p $out + cp $src $out/ + ''; +} diff --git a/bsc/intel-oneapi/oneapi.nix b/bsc/intel-oneapi/oneapi.nix new file mode 100644 index 0000000..d447752 --- /dev/null +++ b/bsc/intel-oneapi/oneapi.nix @@ -0,0 +1,100 @@ +{ lib, stdenv, fetchurl, glibc, glib, libnotify, xdg-utils, ncurses, nss, + at-spi2-core, libdrm, gtk3, mesa, qt515, zlib, xorg, atk, nspr, dbus, + pango, cairo, gdk-pixbuf, xlibsWrapper, cups, expat, libxkbcommon, alsaLib, + file, at-spi2-atk, strace }: + +stdenv.mkDerivation rec { + version = "2022.2.0.262"; + hpc_version = "2022.2.0.191"; + name = "intel-oneapi-${version}"; + + # For localy downloaded offline installers + # sourceRoot = "/data/scratch/intel/oneapi_installer"; + + # For installer fetching (no warranty of the links) + sourceRoot = "."; + srcs = [ + (fetchurl { + url = "https://registrationcenter-download.intel.com/akdlm/irc_nas/18673/l_BaseKit_p_2022.2.0.262_offline.sh"; + sha256 = "03qx6sb58mkhc7iyc8va4y1ihj6l3155dxwmqj8dfw7j2ma7r5f6"; + }) + (fetchurl { + url = "https://registrationcenter-download.intel.com/akdlm/irc_nas/18679/l_HPCKit_p_2022.2.0.191_offline.sh"; + sha256 = "0swz4w9bn58wwqjkqhjqnkcs8k8ms9nn9s8k7j5w6rzvsa6817d2"; + }) + ]; + + nativeBuildInputs = [ file strace ]; + + propagatedBuildInputs = [ glibc glib libnotify xdg-utils ncurses nss + at-spi2-core xorg.libxcb libdrm gtk3 mesa qt515.full + zlib xorg.xlibsWrapper ]; + + libPath = lib.makeLibraryPath [ stdenv.cc.cc xorg.libX11 glib libnotify xdg-utils + ncurses nss at-spi2-core xorg.libxcb libdrm gtk3 + mesa qt515.full zlib atk nspr dbus pango cairo + gdk-pixbuf xlibsWrapper cups expat libxkbcommon alsaLib + at-spi2-atk xorg.libXcomposite xorg.libxshmfence + xorg.libXdamage xorg.libXext xorg.libXfixes + xorg.libXrandr ]; + + phases = [ "installPhase" "fixupPhase" "installCheckPhase" "distPhase" ]; + + installPhase = '' + cd $sourceRoot + mkdir -p $out/tmp + if [ "$srcs" = "" ] + then + base_kit="./l_BaseKit_p_${version}_offline.sh" + hpc_kit="./l_HPCKit_p_${hpc_version}_offline.sh" + else + base_kit=`echo $srcs|cut -d" " -f1` + hpc_kit=`echo $srcs|cut -d" " -f2` + fi + # Extract files + bash $base_kit --log $out/basekit_install_log --extract-only --extract-folder $out/tmp -a --install-dir $out --download-cache $out/tmp --download-dir $out/tmp --log-dir $out/tmp -s --eula accept + bash $hpc_kit --log $out/hpckit_install_log --extract-only --extract-folder $out/tmp -a --install-dir $out --download-cache $out/tmp --download-dir $out/tmp --log-dir $out/tmp -s --eula accept + for file in `grep -l -r "/bin/sh" $out/tmp` + do + sed -e "s,/bin/sh,${stdenv.shell},g" -i $file + done + export HOME=$out + # Patch the bootstraper binaries and libs + for files in `find $out/tmp/l_BaseKit_p_${version}_offline/lib` + do + patchelf --set-rpath "${glibc}/lib:$libPath:$out/tmp/l_BaseKit_p_${version}_offline/lib" $file 2>/dev/null || true + done + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath "${glibc}/lib:$libPath:$out/tmp/l_BaseKit_p_${version}_offline/lib" $out/tmp/l_BaseKit_p_${version}_offline/bootstrapper + # launch install + export LD_LIBRARY_PATH=${zlib}/lib + #export LD_DEBUG=libs + ls -l $out + cd $out/tmp + strace -f -e trace=execve -s 9999 $out/tmp/l_BaseKit_p_${version}_offline/install.sh --install-dir $out --download-cache $out/tmp --download-dir $out/tmp --log-dir $out/tmp --eula accept -s --ignore-errors + $out/tmp/l_HPCKit_p_${hpc_version}_offline/install.sh --install-dir $out --download-cache $out/tmp --download-dir $out/tmp --log-dir $out/tmp --eula accept -s --ignore-errors + rm -rf $out/tmp + ''; + + postFixup = '' + echo "Fixing rights..." + chmod u+w -R $out + echo "Patching rpath and interpreter..." + for dir in `find $out -mindepth 1 -maxdepth 1 -type d` + do + echo " $dir" + for file in `find $dir -type f -exec file {} + | grep ELF| awk -F: '{print $1}'` + do + echo " $file" + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath '$ORIGIN'":${glibc}/lib:$libPath:$dir/latest/lib64" $file 2>/dev/null || true + done + done + ''; + + meta = { + description = "Intel OneAPI Basekit + HPCKit"; + maintainers = [ lib.maintainers.bzizou ]; + platforms = lib.platforms.linux; + license = lib.licenses.unfree; + }; +} + diff --git a/bsc/llvm-ompss2/clang.nix b/bsc/llvm-ompss2/clang.nix index a774771..a552712 100644 --- a/bsc/llvm-ompss2/clang.nix +++ b/bsc/llvm-ompss2/clang.nix @@ -67,7 +67,7 @@ stdenv.mkDerivation rec { "-DCMAKE_CXX_FLAGS_DEBUG=-g -ggnu-pubnames" "-DCMAKE_EXE_LINKER_FLAGS_DEBUG=-Wl,-gdb-index" "-DLLVM_LIT_ARGS=-sv --xunit-xml-output=xunit.xml" - "-DLLVM_ENABLE_PROJECTS=clang;openmp;compiler-rt" + "-DLLVM_ENABLE_PROJECTS=clang;openmp;compiler-rt;flang" "-DLLVM_ENABLE_ASSERTIONS=${enableAssertions}" "-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON" "-DCMAKE_INSTALL_BINDIR=bin" diff --git a/overlay.nix b/overlay.nix index e12cbff..f2065e3 100644 --- a/overlay.nix +++ b/overlay.nix @@ -39,6 +39,14 @@ let icc2021Unwrapped = callPackage ./bsc/intel-compiler/icc2021.nix { }; + #icc2022Unwrapped = callPackage ./bsc/intel-oneapi/2022.3.1.nix { }; + + intel-oneapi = callPackage ./bsc/intel-oneapi/ifort.nix { }; + ifort2022Unwrapped = bsc.intel-oneapi.intel-compiler-fortran; + icc2022Unwrapped = bsc.intel-oneapi.intel-compiler-classic; + + #oneapi2022 = callPackage ./bsc/intel-oneapi/oneapi.nix { }; + # A wrapper script that puts all the flags and environment vars # properly and calls the intel compiler binary icc2020 = appendPasstru (callPackage ./bsc/intel-compiler/default.nix { @@ -50,7 +58,17 @@ let iccUnwrapped = bsc.icc2021Unwrapped; }) { CC = "icx"; CXX = "icpx"; }; - icc = bsc.icc2020; + ifort2022 = callPackage ./bsc/intel-compiler/default.nix { + iccUnwrapped = bsc.ifort2022Unwrapped; + intelLicense = bsc.intelLicense; + }; + + ifort = bsc.ifort2022; + + icc2022 = bsc.intel-oneapi.intel-compiler-classic-wrapper; + + + icc = bsc.icc2022; # We need to set the cc.CC and cc.CXX attributes, in order to # determine the name of the compiler @@ -248,6 +266,7 @@ let dummy = callPackage ./bsc/dummy/default.nix { }; mpptest = callPackage ./bsc/mpptest/default.nix { }; cpuid = callPackage ./bsc/cpuid/default.nix { }; + alya = callPackage ./bsc/alya/default.nix { }; # ================================================================= # Garlic benchmark