evaleev / libint

Libint: high-performance library for computing Gaussian integrals in quantum mechanics
Other
218 stars 96 forks source link

mac+shared+fortran broken #318

Open loriab opened 5 months ago

loriab commented 5 months ago

This is more an issue + demo than a PR. It seems that the Fortran interface on Mac is broken when using a shared Libint library. Release/Debug, Intel/Silicon, and FetchContent/Add_ExternalProject don't matter. The #include catch.hpp is slightly malpositioned, but correcting this doesn't fix things. Possibly flang might be something to try for a coherent c/c++/fortran compiler stack. I don't think this can be accessed in pure libtool, as there isn't a fortran option in configure.ac . Does anyone recall whether this was working at some point?

for when the GHA logs fade away

16: [3/3] Linking CXX executable fortran_test-libint2
16/17 Test #16: libint2/fortran_test/build .......   Passed   32.16 sec
test 17
      Start 17: libint2/fortran_test/run
17: Test command: /Users/runner/work/libint/libint/build/library/libint-2.8.1/build/fortran_test-libint2
17: Working Directory: /Users/runner/work/libint/libint/build/library/libint-2.8.1/build
17: Test timeout computed to be: 10000000
17: 
Errors while running CTest
17: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Output from these tests are in: /Users/runner/work/libint/libint/build/library/libint-2.8.1/build/Testing/Temporary/LastTest.log
17: fortran_test-libint2 is a Catch v2.13.4 host application.
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
17: Run with -? for options
17: 
17: -------------------------------------------------------------------------------
17: Fortran ERI
17: -------------------------------------------------------------------------------
17: /Users/runner/work/libint/libint/build/library/libint-2.8.1/fortran/test-eri.cc:547
17: ...............................................................................
17: 
17: /Users/runner/work/libint/libint/build/library/libint-2.8.1/fortran/test-eri.cc:547: FAILED:
17: due to a fatal error condition:
17:   SIGSEGV - Segmentation violation signal
17: 
17: ===============================================================================
17: test cases: 1 | 1 failed
17: assertions: 1 | 1 failed
17: 
17/17 Test #17: libint2/fortran_test/run .........***Exception: SegFault  0.14 sec
The following tests passed:
    libint2/eritest/build
    libint2/eritest/run0
    libint2/eritest/run1
    libint2/eritest/run2
    libint2/eritest/run3
    libint2/eritest/run4
    libint2/unit/build
    libint2/unit/run
    libint2/unit/sho=gaussian/run
    libint2/hf/build
    libint2/hf/run
    libint2/hf++/build
    libint2/hf++/run
    libint2/fortran_example/build
    libint2/fortran_test/build
88% tests passed, 2 tests failed out of 17
Total Test time (real) = 430.17 sec
The following tests FAILED:
     15 - libint2/fortran_example/run (SEGFAULT)
     17 - libint2/fortran_test/run (SEGFAULT)
FAILED: CMakeFiles/check-libint2 /Users/runner/work/libint/libint/build/library/libint-2.8.1/build/CMakeFiles/check-libint2 
cd /Users/runner/work/libint/libint/build/library/libint-2.8.1/build && /usr/local/Cellar/cmake/3.28.0/bin/ctest -V -R libint2/
ninja: build stopped: subcommand failed.
Error: Process completed with exit code 1.
16: [2/3] Building CXX object CMakeFiles/fortran_test-libint2.dir/fortran/test.cc.o
16: [3/3] Linking CXX executable fortran_test-libint2
16/17 Test #16: libint2/fortran_test/build .......   Passed   32.16 sec
test 17
      Start 17: libint2/fortran_test/run
17: Test command: /Users/runner/work/libint/libint/build/library/libint-2.8.1/build/fortran_test-libint2
17: Working Directory: /Users/runner/work/libint/libint/build/library/libint-2.8.1/build
17: Test timeout computed to be: 10000000
17: 
Errors while running CTest
17: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Output from these tests are in: /Users/runner/work/libint/libint/build/library/libint-2.8.1/build/Testing/Temporary/LastTest.log
17: fortran_test-libint2 is a Catch v2.13.4 host application.
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
17: Run with -? for options
17: 
17: -------------------------------------------------------------------------------
17: Fortran ERI
17: -------------------------------------------------------------------------------
17: /Users/runner/work/libint/libint/build/library/libint-2.8.1/fortran/test-eri.cc:547
17: ...............................................................................
17: 
17: /Users/runner/work/libint/libint/build/library/libint-2.8.1/fortran/test-eri.cc:547: FAILED:
17: due to a fatal error condition:
17:   SIGSEGV - Segmentation violation signal
17: 
17: ===============================================================================
17: test cases: 1 | 1 failed
17: assertions: 1 | 1 failed
17: 
17/17 Test #17: libint2/fortran_test/run .........***Exception: SegFault  0.14 sec
The following tests passed:
    libint2/eritest/build
    libint2/eritest/run0
    libint2/eritest/run1
    libint2/eritest/run2
    libint2/eritest/run3
    libint2/eritest/run4
    libint2/unit/build
    libint2/unit/run
    libint2/unit/sho=gaussian/run
    libint2/hf/build
    libint2/hf/run
    libint2/hf++/build
    libint2/hf++/run
    libint2/fortran_example/build
    libint2/fortran_test/build
88% tests passed, 2 tests failed out of 17
Total Test time (real) = 430.17 sec
The following tests FAILED:
     15 - libint2/fortran_example/run (SEGFAULT)
     17 - libint2/fortran_test/run (SEGFAULT)
FAILED: CMakeFiles/check-libint2 /Users/runner/work/libint/libint/build/library/libint-2.8.1/build/CMakeFiles/check-libint2 
loriab commented 5 months ago

anyone wanting to generate ./configure on Apple Silicon, this gets past the unrecognized machine error.

diff --git a/bin/config.sub b/bin/config.sub
index a44fd8ae..32495efa 100644
--- a/bin/config.sub
+++ b/bin/config.sub
@@ -1101,6 +1101,9 @@ case $cpu-$vendor in
        x64-*)
                cpu=x86_64
                ;;
+       arm64-*)
+               cpu=arm
+               ;;
        xscale-* | xscalee[bl]-*)
                cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
                ;;
loriab commented 5 months ago

The CI here reveals another error which I think comes from the release of setuptools v69. As it currently stands, LIBINT_VERSION isn't getting substituted into setup.py, so the version is '', and setuptools objects. This one I can probably fix.

lto-wrapper: warning: using serial compilation of 11 LTRANS jobs
lto-wrapper: note: see the '-flto' option documentation for more information
[100%] Built target libint2-python
[100%] Built target libint2-python
Traceback (most recent call last):
  File "/usr/share/miniconda3/envs/test/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/share/miniconda3/envs/test/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/runner/work/libint/libint/libint/python/setup.py", line 57, in <module>
    setup(
  File "/usr/share/miniconda3/envs/test/lib/python3.9/site-packages/setuptools/__init__.py", line 103, in setup
    return distutils.core.setup(**attrs)
  File "/usr/share/miniconda3/envs/test/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 147, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/share/miniconda3/envs/test/lib/python3.9/site-packages/setuptools/dist.py", line 314, in __init__
    self.metadata.version = self._normalize_version(self.metadata.version)
  File "/usr/share/miniconda3/envs/test/lib/python3.9/site-packages/setuptools/dist.py", line [35](https://github.com/evaleev/libint/actions/runs/7468095901/job/20323623341?pr=318#step:10:36)0, in _normalize_version
    normalized = str(Version(version))
  File "/usr/share/miniconda3/envs/test/lib/python3.9/site-packages/setuptools/_vendor/packaging/version.py", line 198, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
setuptools.extern.packaging.version.InvalidVersion: Invalid version: ''
evaleev commented 4 months ago

@loriab this can be tossed?

loriab commented 4 months ago

@loriab this can be tossed?

The setuptools/configure on ARM side issues can be tossed (I'll change the PR name back). But as far as I know, the mac+shared+fortran is still broken (segfault from https://github.com/evaleev/libint/pull/318#issuecomment-1884003967). I'll rebase the branch to check.

loriab commented 4 months ago

confirmed, the mac+shared+fortran error persists.