Add intel compiler

This commit is contained in:
Rodrigo Arias 2020-07-01 17:58:29 +02:00
parent 9ca29d5cf8
commit 1f36743459
5 changed files with 121 additions and 39 deletions

View File

@ -4,6 +4,7 @@
, mpi
, tampi
, mcxx
, icc
}:
stdenv.mkDerivation rec {
@ -15,15 +16,14 @@ stdenv.mkDerivation rec {
ref = "master";
};
dontStrip = true;
patchPhase = ''
sed -i 's/mpicc/mpigcc/g' Makefile
#sed -i 's/gcc/icc/g' Makefile
'';
buildInputs = [
nanos6
mpi
icc
tampi
mcxx
];
@ -32,4 +32,5 @@ stdenv.mkDerivation rec {
mkdir -p $out/bin
cp nbody_* $out/bin/
'';
}

View File

@ -1,40 +1,29 @@
{ stdenv
, fetchurl
, rpmextract
{
stdenv
, gcc
, nanos6
, icc-unwrapped
, wrapCCWith
, libstdcxxHook
, intel-license
}:
stdenv.mkDerivation rec {
version = "2019.1.217";
name = "intel-compiler-${version}";
let
targetConfig = stdenv.targetPlatform.config;
inherit gcc;
in wrapCCWith rec {
cc = icc-unwrapped;
extraPackages = [ libstdcxxHook ];
extraBuildCommands = ''
echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $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
# From Arch Linux PKGBUILD
dir_nr="16526";
year="2020";
v_a="1";
v_b="217";
update="1";
composer_xe_dir="compilers_and_libraries_${year}.${v_a}.${v_b}";
tgz="parallel_studio_xe_2020_update${update}_cluster_edition.tgz";
# sha256-/RHY3nKyvWBHT4vOe0Y+TLsiVZabnq8k9olXWqKiq6s=
src = fetchurl {
url = "http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/${dir_nr}/${tgz}";
sha256 = "1axblai5lmw9yqjaz7lvjraj5fsc7r37pklb9x3n1gdjfbgdh4gx";
};
echo "export INTEL_LICENSE_FILE=${intel-license}" \
>> $out/nix-support/setup-hook
buildInputs = [
rpmextract
];
installPhase = ''
rpmextract rpm/intel-icc-*.rpm
rpmextract rpm/intel-comp-*.rpm
mkdir -p $out/{bin,lib,include}
pushd ./opt/intel/${composer_xe_dir}/linux/
cp -a bin/intel64/* $out/bin/
cp -a compiler/include/* $out/include/
popd
# Create the wrappers for icc and icpc
wrap icc $wrapper $ccPath/icc
wrap icpc $wrapper $ccPath/icpc
'';
}

View File

@ -0,0 +1,47 @@
{ stdenv
, fetchurl
, rpmextract
, autoPatchelfHook
, gcc
}:
stdenv.mkDerivation rec {
version = "2019.1.217";
name = "intel-compiler-${version}";
# From Arch Linux PKGBUILD
dir_nr="16526";
year="2020";
v_a="1";
v_b="217";
update="1";
composer_xe_dir="compilers_and_libraries_${year}.${v_a}.${v_b}";
tgz="parallel_studio_xe_2020_update${update}_cluster_edition.tgz";
src = fetchurl {
url = "http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/${dir_nr}/${tgz}";
sha256 = "1axblai5lmw9yqjaz7lvjraj5fsc7r37pklb9x3n1gdjfbgdh4gx";
};
buildInputs = [
rpmextract
autoPatchelfHook
gcc.cc.lib
];
installPhase = ''
rpmextract rpm/intel-icc-*.rpm
rpmextract rpm/intel-comp-*.rpm
rpmextract rpm/intel-c-comp-*.rpm
rpmextract rpm/intel-openmp*.rpm
mkdir -p $out/{bin,lib,include}
pushd ./opt/intel/${composer_xe_dir}/linux/
cp -a bin/intel64/* $out/bin/
cp -a compiler/include/* $out/include/
cp -a compiler/lib/intel64_lin/* $out/lib/
rm $out/lib/*.dbg
popd
'';
}

View File

@ -0,0 +1,39 @@
{ stdenv
, requireFile
}:
stdenv.mkDerivation rec {
name = "intel-compiler-license";
version = "2019.7.217";
src = requireFile {
name = "license.lic";
sha256 = "06g2xgm1lch6zqfkhb768wacdx46kf61mfvj5wfpyssw0anr0x9q";
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/
'';
}

View File

@ -43,8 +43,14 @@ let
enableDebug = false;
};
intel-compiler = intel-compiler-2020;
intel-compiler-2020 = callPackage ./bsc/intel-compiler/default.nix {
icc-unwrapped = callPackage ./bsc/intel-compiler/icc.nix {
};
icc = callPackage bsc/intel-compiler/default.nix {
intel-license = icc-license;
};
icc-license = callPackage bsc/intel-compiler/license.nix {
};
fftw = callPackage ./bsc/fftw/default.nix {