CQCL / pyscf-ac0

GNU General Public License v3.0
3 stars 1 forks source link

Setup procedure does not automatically link libraries to ac0 fortran library #11

Closed conodp closed 1 week ago

conodp commented 6 months ago

While trying to compile the ac0 fortran library for the pyscf-ac0 python interface to InQuanto-pyscf module, the numpy.disutils in setup.py fails in properly linking necessary lapack/blas/mkl routines to the ac0 library.

This is apparently due to the limits of numpy.disutils in searching for library directories in the system. Since numpy.disutils is due to be deprecated soon, maybe a better solution would be with a new automatic procedure? In the meantime, I post here a workaround solution to setup.py where the local directory, where the relevant libraries are located, can be hard coded. The example is for openblas/mkl.

from numpy.distutils.core import setup, Extension
import os
import sys

if sys.platform.startswith("darwin"):  # OSX
    if not "LDFLAGS" in os.environ:
        os.environ["LDFLAGS"] = ""
    os.environ["LDFLAGS"] = (
        os.environ["LDFLAGS"]
        + " -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"
    )

setup_args = dict(
    ext_modules=[
        Extension(
            name='pyscf.cas_ac0.ac0_lib',
            sources=['pyscf/cas_ac0/accas_lib.f90'],
            # uncomment the following 2 lines for openblas libraries
            #library_dirs=['/full/path/where/openblas/libraries/are/located/'],
            #libraries=['openblas'],
            # uncomment the following 2 lines for mkl libraries in intel environment
            #library_dirs=['/full/path/where/mkl/are/in//lib/intel64'],
            #libraries=['mkl_intel_lp64', 'mkl_core', 'mkl_sequential'],
            #in the previous line please change 'intel' with 'gf' if mkl compiled with gcc
        )
    ]
)
setup(**setup_args)
mkrompiec commented 1 week ago

solved by #14