diff --git a/pkgs/development/libraries/science/math/dbcsr/default.nix b/pkgs/development/libraries/science/math/dbcsr/default.nix new file mode 100644 index 000000000000..2175d1343856 --- /dev/null +++ b/pkgs/development/libraries/science/math/dbcsr/default.nix @@ -0,0 +1,81 @@ +{ stdenv +, lib +, fetchFromGitHub +, cmake +, pkg-config +, fypp +, gfortran +, blas +, lapack +, python3 +, libxsmm +, mpi +, openssh +}: + +stdenv.mkDerivation rec { + pname = "dbcsr"; + version = "2.5.0"; + + src = fetchFromGitHub { + owner = "cp2k"; + repo = "dbcsr"; + rev = "v${version}"; + hash = "sha256-GGClK3heGE3zUM0R+u58vRdAK+xWzaqdCHaMIDerHSI="; + }; + + postPatch = '' + patchShebangs . + + # Force build of shared library, otherwise just static. + substituteInPlace src/CMakeLists.txt \ + --replace 'add_library(dbcsr ''${DBCSR_SRCS})' 'add_library(dbcsr SHARED ''${DBCSR_SRCS})' \ + --replace 'add_library(dbcsr_c ''${DBCSR_C_SRCS})' 'add_library(dbcsr_c SHARED ''${DBCSR_C_SRCS})' + + # Avoid calling the fypp wrapper script with python again. The nix wrapper took care of that. + substituteInPlace cmake/fypp-sources.cmake \ + --replace 'COMMAND ''${Python_EXECUTABLE} ''${FYPP_EXECUTABLE}' 'COMMAND ''${FYPP_EXECUTABLE}' + ''; + + nativeBuildInputs = [ + gfortran + python3 + cmake + pkg-config + fypp + ]; + + buildInputs = [ blas lapack libxsmm ]; + + propagatedBuildInputs = [ mpi ]; + + preConfigure = '' + export PKG_CONFIG_PATH=${libxsmm}/lib + ''; + + cmakeFlags = [ + "-DUSE_OPENMP=ON" + "-DUSE_SMM=libxsmm" + "-DWITH_C_API=ON" + "-DBUILD_TESTING=ON" + "-DTEST_OMP_THREADS=2" + "-DTEST_MPI_RANKS=2" + "-DENABLE_SHARED=ON" + "-DUSE_MPI=ON" + ]; + + checkInputs = [ openssh ]; + + doCheck = true; + preCheck = '' + export HYDRA_IFACE=lo # Fix to make mpich run in a sandbox + export OMPI_MCA_rmaps_base_oversubscribe=1 + ''; + + meta = with lib; { + description = "Distributed Block Compressed Sparse Row matrix library"; + license = licenses.gpl2Only; + homepage = "https://github.com/cp2k/dbcsr"; + maintainers = [ maintainers.sheepforce ]; + }; +} diff --git a/pkgs/development/python-modules/fypp/default.nix b/pkgs/development/python-modules/fypp/default.nix new file mode 100644 index 000000000000..9504a5839e73 --- /dev/null +++ b/pkgs/development/python-modules/fypp/default.nix @@ -0,0 +1,20 @@ +{ lib, stdenv, fetchFromGitHub, buildPythonApplication }: + +buildPythonApplication rec { + pname = "fypp"; + version = "3.1"; + + src = fetchFromGitHub { + owner = "aradi"; + repo = pname; + rev = version; + hash = "sha256-iog5Gdcd1F230Nl4JDrKoyYr8JualVgNZQzHLzd4xe8="; + }; + + meta = with lib; { + description = "Python powered Fortran preprocessor"; + homepage = "https://github.com/aradi/fypp"; + license = licenses.gpl3Only; + maintainers = [ maintainers.sheepforce ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7f1ce9e838cf..af8c5d60baa3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -22944,6 +22944,10 @@ with pkgs; toml-f = callPackage ../development/libraries/toml-f { }; + fypp = python3Packages.callPackage ../development/python-modules/fypp { }; + + dbcsr = callPackage ../development/libraries/science/math/dbcsr { }; + ## libGL/libGLU/Mesa stuff # Default libGL implementation, should provide headers and