bscpkgs/garlic/apps/saiph/default.nix

107 lines
2.6 KiB
Nix
Raw Normal View History

2020-06-30 12:19:36 +02:00
{
stdenv
, nanos6
, mpi
, tampi
2020-09-23 13:10:12 +02:00
, cc
2020-06-30 12:19:36 +02:00
, vtk
, boost
2020-09-21 17:30:24 +02:00
, gitBranch ? "master"
2021-02-23 11:51:07 +01:00
, gitCommit ? null
2021-03-24 09:08:55 +01:00
, enableManualDist ? false
, nbgx ? null
, nbgy ? null
, nbgz ? null
, nblx ? null
, nbly ? null
, nblz ? null
2021-02-19 11:18:11 +01:00
, nsteps ? null
2021-03-24 09:08:55 +01:00
, numComm ? null
, enableVectFlags ? false
, enableDebugFlags ? false
, enableAsanFlags ? false
, cachelineBytes ? null
, L3SizeKB ? null
# Problem size:
, sizex ? 3
, sizey ? 4
, sizez ? 4
2021-04-19 16:40:53 +02:00
, garlicTools
2020-06-30 12:19:36 +02:00
}:
assert enableManualDist -> (nbgx != null);
assert enableManualDist -> (nbgy != null);
assert enableManualDist -> (nbgz != null);
with stdenv.lib;
with stdenv.lib.versions;
2021-04-19 16:40:53 +02:00
let
gitSource = garlicTools.fetchGarlicApp {
appName = "saiph";
inherit gitCommit gitBranch;
gitTable = import ./git-table.nix;
};
in
stdenv.mkDerivation rec {
name = "saiph";
2020-06-30 12:19:36 +02:00
2021-04-19 16:40:53 +02:00
inherit (gitSource) src gitBranch gitCommit;
2020-06-30 12:19:36 +02:00
2021-04-19 16:40:53 +02:00
programPath = "/bin/Heat3D_vect";
2020-06-30 12:19:36 +02:00
2021-04-19 16:40:53 +02:00
enableParallelBuilding = true;
dontStrip = true;
enableDebugging = true;
2020-06-30 12:19:36 +02:00
2021-04-19 16:40:53 +02:00
buildInputs = [
nanos6
mpi
tampi
cc
vtk
boost
];
2020-06-30 12:19:36 +02:00
2021-04-19 16:40:53 +02:00
# Required for nanos6
hardeningDisable = [ "all" ];
preBuild = ''
cd saiphv2/cpp/src
export VTK_VERSION=${majorMinor (getVersion vtk.name)}
export VTK_HOME=${vtk}
make clean
2020-06-30 12:19:36 +02:00
2021-04-19 16:40:53 +02:00
sed -i '/SIZEX =/s/3/${toString sizex}/g' testApp/Heat3D_vect.cpp
sed -i '/SIZEY =/s/4/${toString sizey}/g' testApp/Heat3D_vect.cpp
sed -i '/SIZEZ =/s/4/${toString sizez}/g' testApp/Heat3D_vect.cpp
'';
2021-03-24 09:08:55 +01:00
2021-04-19 16:40:53 +02:00
makeFlags = [
"-f" "Makefile.${cc.CC}"
"apps"
"APP=Heat3D_vect"
] ++ optional (cachelineBytes != null) "ROW_ALIGNMENT=${toString cachelineBytes}"
++ optional (L3SizeKB != null) "L3_SIZE_K=${toString L3SizeKB}"
++ optional (enableManualDist) "DIST_SET=1"
++ optional (enableManualDist) "NBG_X=${toString nbgx}"
++ optional (enableManualDist) "NBG_Y=${toString nbgy}"
++ optional (enableManualDist) "NBG_Z=${toString nbgz}"
++ optional (nblx != null) "NBL_X=${toString nblx}"
++ optional (nbly != null) "NBL_Y=${toString nbly}"
++ optional (nblz != null) "NBL_Z=${toString nblz}"
++ optional (nsteps != null) "NSTEPS=${toString nsteps}"
++ optional (numComm != null) "NUM_COMM=${toString numComm}"
++ optional (enableVectFlags) "VECT_CHECKS=1"
++ optional (enableDebugFlags) "DEBUG_CHECKS=1"
++ optional (enableAsanFlags) "SANITIZE_CHECKS=1"
;
installPhase = ''
mkdir -p $out/lib
mkdir -p $out/bin
cp obj/libsaiphv2.so $out/lib/
cp bin/Heat3D_vect $out/bin/
'';
}