fwi: add gitBranch and copy params

This commit is contained in:
Rodrigo Arias 2020-10-30 15:21:23 +01:00 committed by Aleix Roca Nonell
parent 312656ce54
commit 26ad3e49f7

View File

@ -1,30 +1,32 @@
{ {
stdenv stdenv
, nanos6 , mpi ? null
, mpi , tampi ? null
, tampi , mcxx ? null
, mcxx , cc
, icc , gitBranch
}: }:
with stdenv.lib;
assert !(tampi != null && mcxx == null);
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "fwi"; name = "fwi";
variant = "oss+task";
src = builtins.fetchGit { src = builtins.fetchGit {
url = "https://gitlab.com/srodrb/BSC-FWI.git"; url = "https://gitlab.com/srodrb/BSC-FWI.git";
ref = "${variant}"; ref = "${gitBranch}";
}; };
enableParallelBuilding = true; enableParallelBuilding = true;
buildInputs = [ buildInputs = [
nanos6 cc
mpi ]
icc ++ optional (mpi != null) mpi
tampi ++ optional (tampi != null) tampi
mcxx ++ optional (mcxx != null) mcxx;
];
# FIXME: This is an ugly hack. # FIXME: This is an ugly hack.
# When using _GNU_SOURCE or any other definition used in features.h, we need # When using _GNU_SOURCE or any other definition used in features.h, we need
@ -45,15 +47,22 @@ stdenv.mkDerivation rec {
''; '';
makeFlags = [ makeFlags = [
"NZF=108" "CC=${cc.cc.CC}"
"NXF=108"
"NYF=208"
"PRECISION=float"
]; ];
postBuild = ''
make input
'';
#FIXME split the input in another derivation
installPhase = '' installPhase = ''
mkdir -p $out/bin mkdir -p $out/bin
cp fwi $out/bin cp fwi $out/bin
cp ModelGenerator $out/bin cp ModelGenerator $out/bin
mv InputModels $out/bin
mkdir -p $out/etc/fwi
cp SetupParams/{fwi_frequencies.txt,fwi_params.txt} $out/etc/fwi
''; '';
programPath = "/bin/fwi";
} }