Update cp2k old recipe (#44650)
The old build system has issues with the library order. This commit is an attempt to fix it.
This commit is contained in:
		 Taillefumier Mathieu
					Taillefumier Mathieu
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							221e464df3
						
					
				
				
					commit
					3736da3f89
				
			| @@ -472,78 +472,6 @@ def edit(self, pkg, spec, prefix): | |||||||
|         if "superlu-dist@4.3" in spec: |         if "superlu-dist@4.3" in spec: | ||||||
|             ldflags.insert(0, "-Wl,--allow-multiple-definition") |             ldflags.insert(0, "-Wl,--allow-multiple-definition") | ||||||
| 
 | 
 | ||||||
|         if "+plumed" in spec: |  | ||||||
|             dflags.extend(["-D__PLUMED2"]) |  | ||||||
|             cppflags.extend(["-D__PLUMED2"]) |  | ||||||
|             libs.extend([join_path(spec["plumed"].prefix.lib, "libplumed.{0}".format(dso_suffix))]) |  | ||||||
| 
 |  | ||||||
|         cc = spack_cc if "~mpi" in spec else spec["mpi"].mpicc |  | ||||||
|         cxx = spack_cxx if "~mpi" in spec else spec["mpi"].mpicxx |  | ||||||
|         fc = spack_fc if "~mpi" in spec else spec["mpi"].mpifc |  | ||||||
| 
 |  | ||||||
|         # Intel |  | ||||||
|         if "%intel" in spec: |  | ||||||
|             cppflags.extend(["-D__INTEL", "-D__HAS_ISO_C_BINDING", "-D__USE_CP2K_TRACE"]) |  | ||||||
|             fcflags.extend(["-diag-disable 8290,8291,10010,10212,11060", "-free", "-fpp"]) |  | ||||||
| 
 |  | ||||||
|         # FFTW, LAPACK, BLAS |  | ||||||
|         lapack = spec["lapack"].libs |  | ||||||
|         blas = spec["blas"].libs |  | ||||||
|         ldflags.append((lapack + blas).search_flags) |  | ||||||
|         libs.extend([str(x) for x in (fftw.libs, lapack, blas)]) |  | ||||||
| 
 |  | ||||||
|         if spec.satisfies("platform=darwin"): |  | ||||||
|             cppflags.extend(["-D__NO_STATM_ACCESS"]) |  | ||||||
| 
 |  | ||||||
|         if spec["blas"].name in ("intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"): |  | ||||||
|             cppflags += ["-D__MKL"] |  | ||||||
|         elif spec["blas"].name == "accelerate": |  | ||||||
|             cppflags += ["-D__ACCELERATE"] |  | ||||||
| 
 |  | ||||||
|         if "+cosma" in spec: |  | ||||||
|             # add before ScaLAPACK to override the p?gemm symbols |  | ||||||
|             cosma = spec["cosma"].libs |  | ||||||
|             ldflags.append(cosma.search_flags) |  | ||||||
|             libs.extend(cosma) |  | ||||||
| 
 |  | ||||||
|         # MPI |  | ||||||
|         if "+mpi" in spec: |  | ||||||
|             cppflags.extend(["-D__parallel", "-D__SCALAPACK"]) |  | ||||||
| 
 |  | ||||||
|             if spec["mpi"].name == "intel-oneapi-mpi": |  | ||||||
|                 mpi = [join_path(spec["intel-oneapi-mpi"].libs.directories[0], "libmpi.so")] |  | ||||||
|             else: |  | ||||||
|                 mpi = spec["mpi:cxx"].libs |  | ||||||
| 
 |  | ||||||
|             # while intel-mkl has a mpi variant and adds the scalapack |  | ||||||
|             # libs to its libs, intel-oneapi-mkl does not. |  | ||||||
|             if spec["scalapack"].name == "intel-oneapi-mkl": |  | ||||||
|                 mpi_impl = "openmpi" if spec["mpi"].name in ["openmpi", "hpcx-mpi"] else "intelmpi" |  | ||||||
|                 scalapack = [ |  | ||||||
|                     join_path( |  | ||||||
|                         spec["intel-oneapi-mkl"].libs.directories[0], "libmkl_scalapack_lp64.so" |  | ||||||
|                     ), |  | ||||||
|                     join_path( |  | ||||||
|                         spec["intel-oneapi-mkl"].libs.directories[0], |  | ||||||
|                         "libmkl_blacs_{0}_lp64.so".format(mpi_impl), |  | ||||||
|                     ), |  | ||||||
|                 ] |  | ||||||
|             else: |  | ||||||
|                 scalapack = spec["scalapack"].libs |  | ||||||
|                 ldflags.append(scalapack.search_flags) |  | ||||||
| 
 |  | ||||||
|             libs.extend(scalapack) |  | ||||||
|             libs.extend(mpi) |  | ||||||
|             libs.extend(pkg.compiler.stdcxx_libs) |  | ||||||
| 
 |  | ||||||
|             if "+mpi_f08" in spec: |  | ||||||
|                 cppflags.append("-D__MPI_F08") |  | ||||||
| 
 |  | ||||||
|             if "wannier90" in spec: |  | ||||||
|                 cppflags.append("-D__WANNIER90") |  | ||||||
|                 wannier = join_path(spec["wannier90"].libs.directories[0], "libwannier.a") |  | ||||||
|                 libs.append(wannier) |  | ||||||
| 
 |  | ||||||
|         if "+libint" in spec: |         if "+libint" in spec: | ||||||
|             cppflags += ["-D__LIBINT"] |             cppflags += ["-D__LIBINT"] | ||||||
| 
 | 
 | ||||||
| @@ -644,6 +572,91 @@ def edit(self, pkg, spec, prefix): | |||||||
|             fcflags += ["-I{0}".format(sirius.prefix.include.sirius)] |             fcflags += ["-I{0}".format(sirius.prefix.include.sirius)] | ||||||
|             libs += list(sirius.libs) |             libs += list(sirius.libs) | ||||||
| 
 | 
 | ||||||
|  |         if "+plumed" in spec: | ||||||
|  |             dflags.extend(["-D__PLUMED2"]) | ||||||
|  |             cppflags.extend(["-D__PLUMED2"]) | ||||||
|  |             libs.extend([join_path(spec["plumed"].prefix.lib, "libplumed.{0}".format(dso_suffix))]) | ||||||
|  | 
 | ||||||
|  |         if "+libvori" in spec: | ||||||
|  |             cppflags += ["-D__LIBVORI"] | ||||||
|  |             libvori = spec["libvori"].libs | ||||||
|  |             ldflags += [libvori.search_flags] | ||||||
|  |             libs += libvori | ||||||
|  |             libs += ["-lstdc++"] | ||||||
|  | 
 | ||||||
|  |         if "+spglib" in spec: | ||||||
|  |             cppflags += ["-D__SPGLIB"] | ||||||
|  |             spglib = spec["spglib"].libs | ||||||
|  |             ldflags += [spglib.search_flags] | ||||||
|  |             libs += spglib | ||||||
|  | 
 | ||||||
|  |         cc = spack_cc if "~mpi" in spec else spec["mpi"].mpicc | ||||||
|  |         cxx = spack_cxx if "~mpi" in spec else spec["mpi"].mpicxx | ||||||
|  |         fc = spack_fc if "~mpi" in spec else spec["mpi"].mpifc | ||||||
|  | 
 | ||||||
|  |         # Intel | ||||||
|  |         if "%intel" in spec: | ||||||
|  |             cppflags.extend(["-D__INTEL", "-D__HAS_ISO_C_BINDING", "-D__USE_CP2K_TRACE"]) | ||||||
|  |             fcflags.extend(["-diag-disable 8290,8291,10010,10212,11060", "-free", "-fpp"]) | ||||||
|  | 
 | ||||||
|  |         # FFTW, LAPACK, BLAS | ||||||
|  |         lapack = spec["lapack"].libs | ||||||
|  |         blas = spec["blas"].libs | ||||||
|  |         ldflags.append((lapack + blas).search_flags) | ||||||
|  |         libs.extend([str(x) for x in (fftw.libs, lapack, blas)]) | ||||||
|  | 
 | ||||||
|  |         if spec.satisfies("platform=darwin"): | ||||||
|  |             cppflags.extend(["-D__NO_STATM_ACCESS"]) | ||||||
|  | 
 | ||||||
|  |         if spec["blas"].name in ("intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"): | ||||||
|  |             cppflags += ["-D__MKL"] | ||||||
|  |         elif spec["blas"].name == "accelerate": | ||||||
|  |             cppflags += ["-D__ACCELERATE"] | ||||||
|  | 
 | ||||||
|  |         if "+cosma" in spec: | ||||||
|  |             # add before ScaLAPACK to override the p?gemm symbols | ||||||
|  |             cosma = spec["cosma"].libs | ||||||
|  |             ldflags.append(cosma.search_flags) | ||||||
|  |             libs.extend(cosma) | ||||||
|  | 
 | ||||||
|  |         # MPI | ||||||
|  |         if "+mpi" in spec: | ||||||
|  |             cppflags.extend(["-D__parallel", "-D__SCALAPACK"]) | ||||||
|  | 
 | ||||||
|  |             if spec["mpi"].name == "intel-oneapi-mpi": | ||||||
|  |                 mpi = [join_path(spec["intel-oneapi-mpi"].libs.directories[0], "libmpi.so")] | ||||||
|  |             else: | ||||||
|  |                 mpi = spec["mpi:cxx"].libs | ||||||
|  | 
 | ||||||
|  |             # while intel-mkl has a mpi variant and adds the scalapack | ||||||
|  |             # libs to its libs, intel-oneapi-mkl does not. | ||||||
|  |             if spec["scalapack"].name == "intel-oneapi-mkl": | ||||||
|  |                 mpi_impl = "openmpi" if spec["mpi"].name in ["openmpi", "hpcx-mpi"] else "intelmpi" | ||||||
|  |                 scalapack = [ | ||||||
|  |                     join_path( | ||||||
|  |                         spec["intel-oneapi-mkl"].libs.directories[0], "libmkl_scalapack_lp64.so" | ||||||
|  |                     ), | ||||||
|  |                     join_path( | ||||||
|  |                         spec["intel-oneapi-mkl"].libs.directories[0], | ||||||
|  |                         "libmkl_blacs_{0}_lp64.so".format(mpi_impl), | ||||||
|  |                     ), | ||||||
|  |                 ] | ||||||
|  |             else: | ||||||
|  |                 scalapack = spec["scalapack"].libs | ||||||
|  |                 ldflags.append(scalapack.search_flags) | ||||||
|  | 
 | ||||||
|  |             libs.extend(scalapack) | ||||||
|  |             libs.extend(mpi) | ||||||
|  |             libs.extend(pkg.compiler.stdcxx_libs) | ||||||
|  | 
 | ||||||
|  |             if "+mpi_f08" in spec: | ||||||
|  |                 cppflags.append("-D__MPI_F08") | ||||||
|  | 
 | ||||||
|  |             if "wannier90" in spec: | ||||||
|  |                 cppflags.append("-D__WANNIER90") | ||||||
|  |                 wannier = join_path(spec["wannier90"].libs.directories[0], "libwannier.a") | ||||||
|  |                 libs.append(wannier) | ||||||
|  | 
 | ||||||
|         gpuver = "" |         gpuver = "" | ||||||
|         if spec.satisfies("+cuda"): |         if spec.satisfies("+cuda"): | ||||||
|             libs += [ |             libs += [ | ||||||
| @@ -731,19 +744,6 @@ def edit(self, pkg, spec, prefix): | |||||||
|             fcflags += pkgconf("--cflags-only-I", "libxsmmf", output=str).split() |             fcflags += pkgconf("--cflags-only-I", "libxsmmf", output=str).split() | ||||||
|             libs += pkgconf("--libs", "libxsmmf", output=str).split() |             libs += pkgconf("--libs", "libxsmmf", output=str).split() | ||||||
| 
 | 
 | ||||||
|         if "+libvori" in spec: |  | ||||||
|             cppflags += ["-D__LIBVORI"] |  | ||||||
|             libvori = spec["libvori"].libs |  | ||||||
|             ldflags += [libvori.search_flags] |  | ||||||
|             libs += libvori |  | ||||||
|             libs += ["-lstdc++"] |  | ||||||
| 
 |  | ||||||
|         if "+spglib" in spec: |  | ||||||
|             cppflags += ["-D__SPGLIB"] |  | ||||||
|             spglib = spec["spglib"].libs |  | ||||||
|             ldflags += [spglib.search_flags] |  | ||||||
|             libs += spglib |  | ||||||
| 
 |  | ||||||
|         dflags.extend(cppflags) |         dflags.extend(cppflags) | ||||||
|         cflags.extend(cppflags) |         cflags.extend(cppflags) | ||||||
|         cxxflags.extend(cppflags) |         cxxflags.extend(cppflags) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user