fwi: add gitTable to params
This commit is contained in:
parent
9fc2a2025c
commit
5a49611bf6
@ -3,53 +3,60 @@
|
|||||||
, nz ? 200
|
, nz ? 200
|
||||||
, nx ? 200
|
, nx ? 200
|
||||||
, ny ? 500
|
, ny ? 500
|
||||||
|
, gitBranch ? "garlic/seq"
|
||||||
|
, gitCommit ? null
|
||||||
|
, garlicTools
|
||||||
}:
|
}:
|
||||||
|
|
||||||
with stdenv.lib;
|
with stdenv.lib;
|
||||||
with builtins;
|
with builtins;
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
let
|
||||||
name = "fwi-params";
|
gitSource = garlicTools.fetchGarlicApp {
|
||||||
|
appName = "fwi";
|
||||||
src = builtins.fetchGit {
|
inherit gitCommit gitBranch;
|
||||||
url = "ssh://git@bscpm03.bsc.es/garlic/apps/fwi.git";
|
gitTable = import ./git-table.nix;
|
||||||
ref = "garlic/seq";
|
|
||||||
};
|
};
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
name = "fwi-params";
|
||||||
|
|
||||||
enableParallelBuilding = false;
|
inherit (gitSource) src gitBranch gitCommit;
|
||||||
|
|
||||||
# Set the input size with the weird order (nz,nx,ny).
|
enableParallelBuilding = false;
|
||||||
postPatch = ''
|
|
||||||
sed -i 1c${toString nz} SetupParams/fwi_params.txt
|
|
||||||
sed -i 2c${toString nx} SetupParams/fwi_params.txt
|
|
||||||
sed -i 3c${toString ny} SetupParams/fwi_params.txt
|
|
||||||
'';
|
|
||||||
|
|
||||||
# FIXME: This is an ugly hack.
|
# Set the input size with the weird order (nz,nx,ny).
|
||||||
# When using _GNU_SOURCE or any other definition used in features.h, we need
|
postPatch = ''
|
||||||
# to define them before mcc includes nanos6.h from the command line. So the
|
sed -i 1c${toString nz} SetupParams/fwi_params.txt
|
||||||
# only chance is by setting it at the command line with -D. Using the DEFINES
|
sed -i 2c${toString nx} SetupParams/fwi_params.txt
|
||||||
# below, reaches the command line of the preprocessing stage with gcc.
|
sed -i 3c${toString ny} SetupParams/fwi_params.txt
|
||||||
preConfigure = ''
|
'';
|
||||||
export DEFINES=-D_GNU_SOURCE
|
|
||||||
'';
|
|
||||||
|
|
||||||
# We compile the ModelGenerator using gcc *only*, as otherwise it will
|
# FIXME: This is an ugly hack.
|
||||||
# be compiled with nanos6, which requires access to /sys to determine
|
# When using _GNU_SOURCE or any other definition used in features.h, we need
|
||||||
# hardware capabilities. So it will fail in the nix-build environment,
|
# to define them before mcc includes nanos6.h from the command line. So the
|
||||||
# as there is no /sys mounted.
|
# only chance is by setting it at the command line with -D. Using the DEFINES
|
||||||
# Also, we need to compile it with the builder platform as target, as is going
|
# below, reaches the command line of the preprocessing stage with gcc.
|
||||||
# to be executed during the build to generate the src/generated_model_params.h
|
preConfigure = ''
|
||||||
# header.
|
export DEFINES=-D_GNU_SOURCE
|
||||||
makeFlags = [ "COMPILER=GNU" "params" ];
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
# We compile the ModelGenerator using gcc *only*, as otherwise it will
|
||||||
mkdir -p $out/
|
# be compiled with nanos6, which requires access to /sys to determine
|
||||||
cp src/generated_model_params.h $out/
|
# hardware capabilities. So it will fail in the nix-build environment,
|
||||||
cp SetupParams/fwi_params.txt $out/
|
# as there is no /sys mounted.
|
||||||
cp SetupParams/fwi_frequencies.txt $out/
|
# Also, we need to compile it with the builder platform as target, as is going
|
||||||
|
# to be executed during the build to generate the src/generated_model_params.h
|
||||||
|
# header.
|
||||||
|
makeFlags = [ "COMPILER=GNU" "params" ];
|
||||||
|
|
||||||
mkdir -p $out/bin
|
installPhase = ''
|
||||||
cp ModelGenerator $out/bin/
|
mkdir -p $out/
|
||||||
'';
|
cp src/generated_model_params.h $out/
|
||||||
}
|
cp SetupParams/fwi_params.txt $out/
|
||||||
|
cp SetupParams/fwi_frequencies.txt $out/
|
||||||
|
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cp ModelGenerator $out/bin/
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user