25 pythonPackages ? null,
31 if config.cudaSupport then
33 else if config.rocmSupport then
40 assert builtins.elem gpuBackend [
45 assert enablePython -> pythonPackages != null;
47 stdenv.mkDerivation rec {
51 src = fetchFromGitHub {
52 owner = "electronic-structure";
55 hash = "sha256-JvI75AbthNThXep2jcriLTPC8GGiPgrg5nYCCbCi+EI=";
67 ] ++ lib.optional (gpuBackend == "cuda") cudaPackages.cuda_nvcc;
87 ++ lib.optionals (gpuBackend == "cuda") [
88 cudaPackages.cuda_cudart
89 cudaPackages.cuda_profiler_api
90 cudaPackages.cudatoolkit
91 cudaPackages.libcublas
93 ++ lib.optionals (gpuBackend == "rocm") [
97 ++ lib.optionals stdenv.hostPlatform.isDarwin [
100 ++ lib.optionals enablePython (
108 propagatedBuildInputs =
112 ++ lib.optionals enablePython (
125 # GCC 13: error: 'uintptr_t' in namespace 'std' does not name a type
131 "-DSIRIUS_USE_SCALAPACK=ON"
132 "-DSIRIUS_USE_VDWXC=ON"
133 "-DSIRIUS_CREATE_FORTRAN_BINDINGS=ON"
134 "-DSIRIUS_USE_OPENMP=ON"
137 ++ lib.optionals (gpuBackend == "cuda") [
138 "-DSIRIUS_USE_CUDA=ON"
139 "-DCUDA_TOOLKIT_ROOT_DIR=${cudaPackages.cudatoolkit}"
140 (lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" cudaPackages.flags.cmakeCudaArchitecturesString)
142 ++ lib.optionals (gpuBackend == "rocm") [
143 "-DSIRIUS_USE_ROCM=ON"
144 "-DHIP_ROOT_DIR=${rocmPackages.clr}"
146 ++ lib.optionals enablePython [
147 "-DSIRIUS_CREATE_PYTHON_MODULE=ON"
152 # Can not run parallel checks generally as it requires exactly multiples of 4 MPI ranks
153 # Even cpu_serial tests had to be disabled as they require scalapack routines in the sandbox
154 # and run into the same problem as MPI tests
158 ctest --output-on-failure --label-exclude integration_test
163 nativeCheckInputs = [
168 description = "Domain specific library for electronic structure calculations";
169 homepage = "https://github.com/electronic-structure/SIRIUS";
170 license = licenses.bsd2;
171 platforms = platforms.linux;
172 maintainers = [ maintainers.sheepforce ];