From a1f33444b584d2d0f169620c2309f46099452cb0 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 30 Jun 2020 12:19:36 +0200 Subject: [PATCH] Testing saiph app --- bsc/apps/nbody/default.nix | 4 ++ bsc/apps/saiph/default.nix | 45 ++++++++++++++++++++++ bsc/vtk/default.nix | 76 ++++++++++++++++++++++++++++++++++++++ default.nix | 25 +++++++++++-- 4 files changed, 146 insertions(+), 4 deletions(-) create mode 100644 bsc/apps/saiph/default.nix create mode 100644 bsc/vtk/default.nix diff --git a/bsc/apps/nbody/default.nix b/bsc/apps/nbody/default.nix index 840635d..2bee99a 100644 --- a/bsc/apps/nbody/default.nix +++ b/bsc/apps/nbody/default.nix @@ -17,6 +17,10 @@ stdenv.mkDerivation rec { dontStrip = true; + patchPhase = '' + sed -i 's/mpicc/mpigcc/g' Makefile + ''; + buildInputs = [ nanos6 mpi diff --git a/bsc/apps/saiph/default.nix b/bsc/apps/saiph/default.nix new file mode 100644 index 0000000..fb46fda --- /dev/null +++ b/bsc/apps/saiph/default.nix @@ -0,0 +1,45 @@ +{ + stdenv +, nanos6 +, mpi +, tampi +, mcxx +, vtk +, boost +}: + +stdenv.mkDerivation rec { + name = "nbody"; + + src = builtins.fetchGit { + url = "ssh://git@bscpm02.bsc.es/DSLs/saiph.git"; + #rev = "a8372abf9fc7cbc2db0778de80512ad4af244c29"; + ref = "VectorisationSupport"; + }; + + #dontStrip = true; + +# preBuild = '' +# cd saiphv2/cpp/src +# ''; + + buildInputs = [ + nanos6 + mpi + tampi + mcxx + vtk + boost + ]; + + buildPhase = '' + pwd + cd saiphv2/cpp/src + make -f Makefile.clang apps=ExHeat + ''; + + installPhase = '' + mkdir -p $out/bin + #cp nbody_* $out/bin/ + ''; +} diff --git a/bsc/vtk/default.nix b/bsc/vtk/default.nix new file mode 100644 index 0000000..9bf9aa3 --- /dev/null +++ b/bsc/vtk/default.nix @@ -0,0 +1,76 @@ +{ + stdenv +, fetchurl +, cmake +, libGLU +, libGL +, libX11 +, xorgproto +, libXt +, libtiff +, qtLib ? null +, enablePython ? false, python ? null +, mpi ? null +}: + +with stdenv.lib; + +let + os = stdenv.lib.optionalString; + majorVersion = "8.2"; + minorVersion = "0"; + version = "${majorVersion}.${minorVersion}"; +in + +stdenv.mkDerivation rec { + name = "vtk-${os (qtLib != null) "qvtk-"}${version}"; + src = fetchurl { + url = "${meta.homepage}files/release/${majorVersion}/VTK-${version}.tar.gz"; + sha256 = "1fspgp8k0myr6p2a6wkc21ldcswb4bvmb484m12mxgk1a9vxrhrl"; + }; + + nativeBuildInputs = [ cmake ]; + + buildInputs = [ libtiff ] + ++ optionals (qtLib != null) (with qtLib; [ qtbase qtx11extras qttools ]) + ++ optional (qtLib != null) (with qtLib; [ qtbase qtx11extras qttools ]) + ++ optionals stdenv.isLinux [ libGLU libGL libX11 xorgproto libXt ] + ++ optional enablePython [ python ] + ++ optional (mpi != null) [ mpi ]; + + preBuild = '' + export LD_LIBRARY_PATH="$(pwd)/lib"; + ''; + + # Shared libraries don't work, because of rpath troubles with the current + # nixpkgs cmake approach. It wants to call a binary at build time, just + # built and requiring one of the shared objects. + # At least, we use -fPIC for other packages to be able to use this in shared + # objects. + cmakeFlags = [ + "-DCMAKE_C_FLAGS=-fPIC" + "-DCMAKE_CXX_FLAGS=-fPIC" + "-DVTK_USE_SYSTEM_TIFF=1" + "-DVTK_Group_MPI=ON" + "-DBUILD_SHARED_LIBS=ON" + "-DOPENGL_INCLUDE_DIR=${libGL}/include" + ] + ++ optional (mpi != null) [ + "-DVTK_Group_MPI=ON" ] + ++ optional (qtLib != null) [ + "-DVTK_Group_Qt:BOOL=ON" ] + ++ optional stdenv.isDarwin [ + "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks" ] + ++ optional enablePython [ + "-DVTK_WRAP_PYTHON:BOOL=ON" ]; + + enableParallelBuilding = true; + + meta = { + description = "Open source libraries for 3D computer graphics, image processing and visualization"; + homepage = "https://www.vtk.org/"; + license = stdenv.lib.licenses.bsd3; + maintainers = with stdenv.lib.maintainers; [ knedlsepp ]; + platforms = with stdenv.lib.platforms; unix; + }; +} diff --git a/default.nix b/default.nix index daafccf..ab3f4a8 100644 --- a/default.nix +++ b/default.nix @@ -15,10 +15,13 @@ let #mpi = intel-mpi; # Load the default compiler - #stdenv = pkgs.gcc7Stdenv; - #stdenv = pkgs.gcc9Stdenv; #stdenv = pkgs.gcc10Stdenv; - stdenv = pkgs.clangStdenv; + #stdenv = pkgs.gcc9Stdenv; + #stdenv = pkgs.gcc7Stdenv; + stdenv = pkgs.llvmPackages_10.stdenv; + #stdenv = pkgs.llvmPackages_9.stdenv; + #stdenv = pkgs.llvmPackages_8.stdenv; + #stdenv = pkgs.llvmPackages_7.stdenv; binutils = pkgs.binutils; coreutils = pkgs.coreutils; @@ -66,6 +69,11 @@ let extrae = extrae; }; + vtk = callPackage ./bsc/vtk/default.nix { + mpi = mpi; + inherit (pkgs.xorg) libX11 xorgproto libXt; + }; + dummy = callPackage ./bsc/dummy/default.nix { }; @@ -91,11 +99,20 @@ let # Apps for Garlic nbody = callPackage ./bsc/apps/nbody/default.nix { stdenv = pkgs.gcc9Stdenv; - mpi = mpi; + mpi = intel-mpi; tampi = tampi; nanos6 = nanos6-git; }; + saiph = callPackage ./bsc/apps/saiph/default.nix { + stdenv = stdenv-nanos6; + mpi = intel-mpi; + tampi = tampi; + nanos6 = nanos6-git; + inherit vtk; + boost = pkgs.boost; + }; + # Patched nix for deep cluster inherit (callPackage ./bsc/nix/default.nix { storeDir = "/nix/store";