Skip to content

Commit

Permalink
simgrid: add 3.34, use it by default/for batsim
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoquet committed Aug 2, 2023
1 parent 2db557e commit 91bfc06
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 3 deletions.
8 changes: 5 additions & 3 deletions nur.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ rec {

batexpe = pkgs.callPackage ./pkgs/batexpe { };

batsim-410 = pkgs.callPackage ./pkgs/batsim/batsim410.nix { inherit redox debug; simgrid = simgrid-332light; intervalset = intervalsetlight; };
batsim-410 = pkgs.callPackage ./pkgs/batsim/batsim410.nix { inherit redox debug; simgrid = simgrid-334light; intervalset = intervalsetlight; };
batsim = batsim-410;
batsim-docker = pkgs.callPackage ./pkgs/batsim/batsim-docker.nix { inherit batsim; };

Expand Down Expand Up @@ -137,14 +137,16 @@ rec {
simgrid-330 = pkgs.callPackage ./pkgs/simgrid/simgrid330.nix { inherit debug; };
simgrid-331 = pkgs.callPackage ./pkgs/simgrid/simgrid331.nix { inherit debug; };
simgrid-332 = pkgs.callPackage ./pkgs/simgrid/simgrid332.nix { inherit debug; };
simgrid-334 = pkgs.callPackage ./pkgs/simgrid/simgrid334.nix { inherit debug; };
simgrid-327light = simgrid-327.override { minimalBindings = true; withoutBin = true; withoutBoostPropagation = true; };
simgrid-328light = simgrid-328.override { minimalBindings = true; withoutBin = true; withoutBoostPropagation = true; };
simgrid-329light = simgrid-329.override { minimalBindings = true; withoutBin = true; withoutBoostPropagation = true; };
simgrid-330light = simgrid-330.override { minimalBindings = true; withoutBin = true; withoutBoostPropagation = true; buildPythonBindings = false; };
simgrid-331light = simgrid-331.override { minimalBindings = true; withoutBin = true; withoutBoostPropagation = true; buildPythonBindings = false; };
simgrid-332light = simgrid-332.override { minimalBindings = true; withoutBin = true; withoutBoostPropagation = true; buildPythonBindings = false; };
simgrid = simgrid-332;
simgrid-light = simgrid-332light;
simgrid-334light = simgrid-334.override { minimalBindings = true; withoutBin = true; withoutBoostPropagation = true; buildPythonBindings = false; };
simgrid = simgrid-334;
simgrid-light = simgrid-334light;

# Setting needed for nixos-19.03 and nixos-19.09
slurm-bsc-simulator =
Expand Down
126 changes: 126 additions & 0 deletions pkgs/simgrid/simgrid334.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{ stdenv, lib, fetchFromGitLab, cmake, perl, python3, boost
, fortranSupport ? false, gfortran
, buildDocumentation ? false, fig2dev, ghostscript, doxygen
, buildJavaBindings ? false, openjdk
, buildPythonBindings ? false, python3Packages
, modelCheckingSupport ? false, libunwind, libevent, elfutils # Inside elfutils: libelf and libdw
, bmfSupport ? true, eigen
, minimalBindings ? false
, debug ? false
, optimize ? (!debug)
, moreTests ? false
, withoutBin ? false
, withoutBoostPropagation ? false
}:

with lib;

let
optionOnOff = option: if option then "on" else "off";
in

stdenv.mkDerivation rec {
pname = "simgrid";
version = "3.34";

src = fetchFromGitLab {
domain = "framagit.org";
owner = pname;
repo = pname;
rev = "v${version}";
sha256 = "sha256-EVTpW9jD1h8T2KRlDIqptKS6Wv1dVDfyJbXxrpsgmoo=";
};

propagatedBuildInputs = optionals (!withoutBoostPropagation) [ boost ];
nativeBuildInputs = [ cmake perl python3 ]
++ optionals withoutBoostPropagation [ boost ]
++ optionals fortranSupport [ gfortran ]
++ optionals buildJavaBindings [ openjdk ]
++ optionals buildPythonBindings [ python3Packages.pybind11 ]
++ optionals buildDocumentation [ fig2dev ghostscript doxygen ]
++ optionals bmfSupport [ eigen ]
++ optionals modelCheckingSupport [ libunwind libevent elfutils ];

outputs = [ "out" ]
++ optionals buildPythonBindings [ "python" ];

# "Release" does not work. non-debug mode is Debug compiled with optimization
cmakeBuildType = "Debug";
cmakeFlags = [
"-Denable_documentation=${optionOnOff buildDocumentation}"
"-Denable_java=${optionOnOff buildJavaBindings}"
"-Denable_python=${optionOnOff buildPythonBindings}"
"-DSIMGRID_PYTHON_LIBDIR=./" # prevents CMake to install in ${python3} dir
"-Denable_msg=${optionOnOff buildJavaBindings}"
"-Denable_fortran=${optionOnOff fortranSupport}"
"-Denable_model-checking=${optionOnOff modelCheckingSupport}"
"-Denable_ns3=off"
"-Denable_lua=off"
"-Denable_lib_in_jar=off"
"-Denable_maintainer_mode=off"
"-Denable_mallocators=on"
"-Denable_debug=on"
"-Denable_smpi=on"
"-Dminimal-bindings=${optionOnOff minimalBindings}"
"-Denable_smpi_ISP_testsuite=${optionOnOff moreTests}"
"-Denable_smpi_MPICH3_testsuite=${optionOnOff moreTests}"
"-Denable_compile_warnings=off"
"-Denable_compile_optimizations=${optionOnOff optimize}"
"-Denable_lto=${optionOnOff optimize}"
];
makeFlags = optional debug "VERBOSE=1";

# needed to run tests and to ensure correct shabangs in output scripts
preBuild = ''
patchShebangs ..
'';

# needed by tests (so libsimgrid.so is found)
preConfigure = ''
export LD_LIBRARY_PATH="$PWD/build/lib"
'';

doCheck = true;
preCheck = ''
# prevent the execution of tests known to fail
cat <<EOW >CTestCustom.cmake
SET(CTEST_CUSTOM_TESTS_IGNORE smpi-replay-multiple)
EOW
# make sure tests are built in parallel (this can be long otherwise)
make tests -j $NIX_BUILD_CORES
'';

postInstall = lib.optionalString withoutBin ''
# remove bin from output if requested.
# having a specific bin output would be cleaner but it does not work currently (circular references)
rm -rf $out/bin
rm -f $out/lib/simgrid/smpimain
rm -f $out/lib/simgrid/smpireplaymain
'' + lib.optionalString buildPythonBindings ''
# manually install the python binding if requested.
mkdir -p $python/lib/python${lib.versions.majorMinor python3.version}/site-packages/
cp ./lib/simgrid.cpython*.so $python/lib/python${lib.versions.majorMinor python3.version}/site-packages/
'';

# improve debuggability if requested
hardeningDisable = lib.optionals debug [ "fortify" ];
dontStrip = debug;

meta = {
description = "Framework for the simulation of distributed applications";
longDescription = ''
SimGrid is a toolkit that provides core functionalities for the
simulation of distributed applications in heterogeneous distributed
environments. The specific goal of the project is to facilitate
research in the area of distributed and parallel application
scheduling on distributed computing platforms ranging from simple
network of workstations to Computational Grids.
'';
homepage = "https://simgrid.org/";
license = licenses.lgpl2Plus;
maintainers = with maintainers; [ mickours mpoquet ];
platforms = platforms.all;
broken = stdenv.isDarwin;
};
}

0 comments on commit 91bfc06

Please sign in to comment.