Archived
1
0
forked from rarias/bscpkgs

fwi: add gitTable

This commit is contained in:
2021-04-19 13:32:43 +02:00
parent 20e99f122f
commit 9377adf787
2 changed files with 66 additions and 46 deletions

View File

@@ -5,65 +5,70 @@
, mcxx ? null
, cc
, gitBranch ? "garlic/tampi+send+oss+task"
, gitCommit ? null
, fwiParams
, garlicTools
}:
with stdenv.lib;
assert !(tampi != null && mcxx == null);
stdenv.mkDerivation rec {
inherit gitBranch;
name = "fwi";
src = builtins.fetchGit {
url = "ssh://git@bscpm03.bsc.es/garlic/apps/fwi.git";
ref = "${gitBranch}";
let
gitSource = garlicTools.fetchGarlicApp {
appName = "fwi";
inherit gitCommit gitBranch;
gitTable = import ./git-table.nix;
};
in
stdenv.mkDerivation rec {
name = "fwi";
enableParallelBuilding = false;
inherit (gitSource) src gitBranch gitCommit;
buildInputs = [
cc
]
++ optional (mpi != null) mpi
++ optional (tampi != null) tampi
++ optional (mcxx != null) mcxx;
enableParallelBuilding = false;
# FIXME: Correct this on the Makefile so we can just type "make fwi"
# FIXME: Allow multiple MPI implementations
postPatch = ''
sed -i 's/= OPENMPI$/= INTEL/g' Makefile
sed -i 's/USE_O_DIRECT ?= NO/USE_O_DIRECT ?= YES/g' Makefile || true
'';
buildInputs = [
cc
]
++ optional (mpi != null) mpi
++ optional (tampi != null) tampi
++ optional (mcxx != null) mcxx;
# FIXME: This is an ugly hack.
# When using _GNU_SOURCE or any other definition used in features.h, we need
# to define them before mcc includes nanos6.h from the command line. So the
# only chance is by setting it at the command line with -D. Using the DEFINES
# below, reaches the command line of the preprocessing stage with gcc.
preConfigure = ''
export DEFINES=-D_GNU_SOURCE
# FIXME: Correct this on the Makefile so we can just type "make fwi"
# FIXME: Allow multiple MPI implementations
postPatch = ''
sed -i 's/= OPENMPI$/= INTEL/g' Makefile
sed -i 's/USE_O_DIRECT ?= NO/USE_O_DIRECT ?= YES/g' Makefile || true
'';
make depend
# FIXME: This is an ugly hack.
# When using _GNU_SOURCE or any other definition used in features.h, we need
# to define them before mcc includes nanos6.h from the command line. So the
# only chance is by setting it at the command line with -D. Using the DEFINES
# below, reaches the command line of the preprocessing stage with gcc.
preConfigure = ''
export DEFINES=-D_GNU_SOURCE
cp ${fwiParams}/generated_model_params.h src/
'';
# We compile the ModelGenerator using gcc *only*, as otherwise it will
# be compiled with nanos6, which requires access to /sys to determine
# hardware capabilities. So it will fail in the nix-build environment,
# as there is no /sys mounted.
makeFlags = [
#"COMPILER=GNU"
#"CC=${cc.cc.CC}"
"fwi"
];
make depend
installPhase = ''
mkdir -p $out/bin
cp fwi $out/bin
'';
cp ${fwiParams}/generated_model_params.h src/
'';
programPath = "/bin/fwi";
}
# We compile the ModelGenerator using gcc *only*, as otherwise it will
# be compiled with nanos6, which requires access to /sys to determine
# hardware capabilities. So it will fail in the nix-build environment,
# as there is no /sys mounted.
makeFlags = [
#"COMPILER=GNU"
#"CC=${cc.cc.CC}"
"fwi"
];
installPhase = ''
mkdir -p $out/bin
cp fwi $out/bin
'';
programPath = "/bin/fwi";
}