Add libxc 5.0.0 (#17807)
With experimental CUDA support and some patches to make it compile. Currently +shared and +cuda conflict, this has to be fixed upstream.
This commit is contained in:
parent
346977f501
commit
d4831181ea
@ -0,0 +1,26 @@
|
||||
From 205a08a30ee0d057d173f9eaa6fc6414f6960c22 Mon Sep 17 00:00:00 2001
|
||||
From: Xavier Andrade <xavier@tddft.org>
|
||||
Date: Wed, 27 May 2020 15:42:32 -0700
|
||||
Subject: [PATCH] Bugfix: avoid implicit pointer cast to make libxc compile
|
||||
with a C++ compiler.
|
||||
|
||||
---
|
||||
src/functionals.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/functionals.c b/src/functionals.c
|
||||
index 3f668292..293f7f9b 100644
|
||||
--- a/src/functionals.c
|
||||
+++ b/src/functionals.c
|
||||
@@ -324,7 +324,7 @@ xc_func_set_ext_params_name(xc_func_type *p, const char *name, double par)
|
||||
|
||||
assert(p != NULL && p->info->ext_params.n > 0);
|
||||
|
||||
- ext_params = libxc_malloc(p->info->ext_params.n*sizeof(double));
|
||||
+ ext_params = (double *) libxc_malloc(p->info->ext_params.n*sizeof(double));
|
||||
for(ii=0; ii<p->info->ext_params.n; ii++){
|
||||
if(strcmp(p->info->ext_params.names[ii], name) == 0)
|
||||
ext_params[ii] = par;
|
||||
--
|
||||
2.25.1
|
||||
|
@ -0,0 +1,33 @@
|
||||
From 11b90a0a477925f19dfeb7e1f672058f25d83387 Mon Sep 17 00:00:00 2001
|
||||
From: Harmen Stoppels <harmenstoppels@gmail.com>
|
||||
Date: Fri, 31 Jul 2020 13:54:39 +0200
|
||||
Subject: [PATCH] Mark xc_erfcx a GPU_FUNCTION
|
||||
|
||||
---
|
||||
src/faddeeva.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/faddeeva.c b/src/faddeeva.c
|
||||
index ceec4736..03484713 100644
|
||||
--- a/src/faddeeva.c
|
||||
+++ b/src/faddeeva.c
|
||||
@@ -29,6 +29,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
+#include "util.h"
|
||||
+
|
||||
#include <math.h>
|
||||
|
||||
/* erfcx(x) = exp(x^2) erfc(x) function, for real x, written by
|
||||
@@ -477,6 +479,7 @@ return 0.97771701335885035464e0 + (0.22000938572830479551e-1 + (0.27951610702682
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
+GPU_FUNCTION
|
||||
double xc_erfcx(double x)
|
||||
{
|
||||
if (x >= 0) {
|
||||
--
|
||||
2.25.1
|
||||
|
@ -6,13 +6,14 @@
|
||||
from spack import *
|
||||
|
||||
|
||||
class Libxc(AutotoolsPackage):
|
||||
class Libxc(AutotoolsPackage, CudaPackage):
|
||||
"""Libxc is a library of exchange-correlation functionals for
|
||||
density-functional theory."""
|
||||
|
||||
homepage = "https://tddft.org/programs/libxc/"
|
||||
url = "https://www.tddft.org/programs/libxc/down.php?file=2.2.2/libxc-2.2.2.tar.gz"
|
||||
|
||||
version('5.0.0', sha256='1cdc57930f7b57da4eb9b2c55a50ba1c2c385936ddaf5582fee830994461a892')
|
||||
version('4.3.4', sha256='a8ee37ddc5079339854bd313272856c9d41a27802472ee9ae44b58ee9a298337')
|
||||
version('4.3.2', sha256='bc159aea2537521998c7fb1199789e1be71e04c4b7758d58282622e347603a6f')
|
||||
version('4.2.3', sha256='02e49e9ba7d21d18df17e9e57eae861e6ce05e65e966e1e832475aa09e344256')
|
||||
@ -20,6 +21,14 @@ class Libxc(AutotoolsPackage):
|
||||
version('2.2.2', sha256='6ca1d0bb5fdc341d59960707bc67f23ad54de8a6018e19e02eee2b16ea7cc642')
|
||||
version('2.2.1', sha256='ade61c1fa4ed238edd56408fd8ee6c2e305a3d5753e160017e2a71817c98fd00')
|
||||
|
||||
variant('shared', default=True, description='Build shared libraries')
|
||||
|
||||
conflicts('+shared +cuda', msg='Only ~shared supported with +cuda')
|
||||
conflicts('+cuda', when='@:4', msg='CUDA support only in libxc 5.0.0 and above')
|
||||
|
||||
patch('0001-Bugfix-avoid-implicit-pointer-cast-to-make-libxc-com.patch', when='@5.0.0')
|
||||
patch('0002-Mark-xc_erfcx-a-GPU_FUNCTION.patch', when='@5.0.0')
|
||||
|
||||
@property
|
||||
def libs(self):
|
||||
"""Libxc can be queried for the following parameters:
|
||||
@ -36,7 +45,8 @@ def libs(self):
|
||||
# Libxc installs both shared and static libraries.
|
||||
# If a client ask for static explicitly then return
|
||||
# the static libraries
|
||||
shared = ('static' not in query_parameters)
|
||||
shared = (self.spec.variants['shared'].value and
|
||||
'static' not in query_parameters)
|
||||
|
||||
# Libxc has a fortran90 interface: give clients the
|
||||
# possibility to query for it
|
||||
@ -82,8 +92,24 @@ def setup_build_environment(self, env):
|
||||
env.append_flags('CFLAGS', optflags)
|
||||
env.append_flags('FCFLAGS', optflags)
|
||||
|
||||
if '+cuda' in self.spec:
|
||||
nvcc = self.spec['cuda'].prefix.bin.nvcc
|
||||
env.set('CCLD', '{0} -ccbin {1}'.format(nvcc, spack_cc))
|
||||
env.set('CC', '{0} -x cu -ccbin {1}'.format(nvcc, spack_cc))
|
||||
|
||||
cuda_arch = self.spec.variants['cuda_arch'].value[0]
|
||||
|
||||
if cuda_arch != 'none':
|
||||
env.append_flags('CFLAGS', '-arch=sm_{0}'.format(cuda_arch))
|
||||
|
||||
def configure_args(self):
|
||||
args = ['--enable-shared']
|
||||
spec = self.spec
|
||||
|
||||
args = [
|
||||
'--enable-shared' if '+shared' in spec else '--disable-shared',
|
||||
'--enable-cuda' if '+cuda' in spec else '--disable-cuda'
|
||||
]
|
||||
|
||||
return args
|
||||
|
||||
def check(self):
|
||||
|
Loading…
Reference in New Issue
Block a user