diff --git a/.github/workflows/jobs.yml b/.github/workflows/jobs.yml index 843c6aa08..1f63e2c4e 100644 --- a/.github/workflows/jobs.yml +++ b/.github/workflows/jobs.yml @@ -40,7 +40,7 @@ jobs: - name: Update OS run: sudo apt-get update - name: Install apt-get dependencies - run: sudo apt-get install -y gfortran gcc g++ openmpi-bin libopenmpi-dev libblas-dev liblapack-dev cmake + run: sudo apt-get install -y gfortran gcc g++ openmpi-bin libopenmpi-dev libblas-dev liblapack-dev libeigen3-dev cmake - name: Run job run: | mkdir build @@ -88,7 +88,7 @@ jobs: - name: Update OS run: sudo apt-get update - name: Install apt-get dependencies - run: sudo apt-get install -y gfortran gcc g++ openmpi-bin libopenmpi-dev libblas-dev liblapack-dev automake autoconf pkg-config libtool + run: sudo apt-get install -y gfortran gcc g++ openmpi-bin libopenmpi-dev libblas-dev liblapack-dev libeigen3-dev automake autoconf pkg-config libtool - name: Run job run: | ./bootstrap diff --git a/.gitignore b/.gitignore index a8ebcfc23..cad9087a8 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,6 @@ libtool .deps/ arpack*.pc parpack*.pc -arpackSolver*.pc arpackdef.h arpackicb.h tstAutotoolsInstall.sh diff --git a/CHANGES b/CHANGES index 7e37f57fb..2ce7c42ff 100644 --- a/CHANGES +++ b/CHANGES @@ -15,6 +15,7 @@ arpack-ng - 3.9.1 * README: Add details on Windows installation. [ Franck Houssen ] + * [BUG FIX] Fix install: headers in /path/to/local/include/arpack for ICB samples * [BUG FIX] Fix install: headers in /path/to/local/include/arpack * arpackmm: allow for using LA/SA magnitudes. * Rename icbexmm option into eigen option. diff --git a/CMakeLists.txt b/CMakeLists.txt index 690cad4ad..971570642 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.5) if (NOT DEFINED CMAKE_BUILD_TYPE) set (CMAKE_BUILD_TYPE Release CACHE STRING "Build type") @@ -831,8 +831,6 @@ string(REPLACE ";" " " PARPACK_PC_LIBS_PRIVATE "${PARPACK_PC_LIBS_PRIVATE}") configure_file(pkg-config/arpack.pc.in "${PROJECT_BINARY_DIR}/arpack${LIBSUFFIX}${ITF64SUFFIX}.pc" @ONLY) configure_file(pkg-config/parpack.pc.in "${PROJECT_BINARY_DIR}/parpack${LIBSUFFIX}${ITF64SUFFIX}.pc" @ONLY) -configure_file(pkg-config/arpackSolver.pc.in "${PROJECT_BINARY_DIR}/arpackSolver${LIBSUFFIX}${ITF64SUFFIX}.pc" @ONLY) - install(TARGETS arpack EXPORT arpackngTargets @@ -861,7 +859,6 @@ if(ICB) endif() if (EIGEN) install(FILES EXAMPLES/MATRIX_MARKET/arpackSolver.hpp DESTINATION ${ARPACK_INSTALL_INCLUDEDIR}) - install(FILES "${PROJECT_BINARY_DIR}/arpackSolver${LIBSUFFIX}${ITF64SUFFIX}.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) endif() endif() diff --git a/EXAMPLES/MATRIX_MARKET/Makefile.am b/EXAMPLES/MATRIX_MARKET/Makefile.am index 6be7da2bc..a24240bed 100644 --- a/EXAMPLES/MATRIX_MARKET/Makefile.am +++ b/EXAMPLES/MATRIX_MARKET/Makefile.am @@ -10,6 +10,7 @@ TESTS = arpackmm.sh issue401.sh issue215.sh arpackmm_SOURCES = arpackmm.cpp +pkgincludedir = $(includedir)/arpack@ITF64SUFFIX@ if EIGEN pkginclude_HEADERS = arpackSolver.hpp endif diff --git a/ICB/Makefile.am b/ICB/Makefile.am index 8587e08a9..bbe6ec72f 100644 --- a/ICB/Makefile.am +++ b/ICB/Makefile.am @@ -1,5 +1,6 @@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) +pkgincludedir = $(includedir)/arpack@ITF64SUFFIX@ pkginclude_HEADERS = debug_c.h debug_c.hpp pkginclude_HEADERS += stat_c.h stat_c.hpp pkginclude_HEADERS += arpack.h arpack.hpp diff --git a/Makefile.am b/Makefile.am index 8bf932a97..124c79146 100644 --- a/Makefile.am +++ b/Makefile.am @@ -27,7 +27,7 @@ endif EXTRA_DIST = README.md PARPACK_CHANGES CHANGES DOCUMENTS VISUAL_STUDIO \ detect_arpack_bug.m4 CMakeLists.txt -pkgconfig_DATA = arpack@LIBSUFFIX@@ITF64SUFFIX@.pc parpack@LIBSUFFIX@@ITF64SUFFIX@.pc arpackSolver@LIBSUFFIX@@ITF64SUFFIX@.pc +pkgconfig_DATA = arpack@LIBSUFFIX@@ITF64SUFFIX@.pc parpack@LIBSUFFIX@@ITF64SUFFIX@.pc # Due to the LIBSUFFIX/ITF64SUFFIX, configure doesn't automatically clean this file: -DISTCLEANFILES = arpack@LIBSUFFIX@@ITF64SUFFIX@.pc parpack@LIBSUFFIX@@ITF64SUFFIX@.pc arpackSolver@LIBSUFFIX@@ITF64SUFFIX@.pc +DISTCLEANFILES = arpack@LIBSUFFIX@@ITF64SUFFIX@.pc parpack@LIBSUFFIX@@ITF64SUFFIX@.pc diff --git a/README.md b/README.md index af40e4c2d..51625c3e3 100644 --- a/README.md +++ b/README.md @@ -286,6 +286,19 @@ $ LIBS="-framework Accelerate" FFLAGS="-ff2c -fno-second-underscore" FCFLAGS="-f ## Using arpack-ng from your own codebase +The `*.pc` and `*.cmake` files provided by `arpack-ng` are only pointing to arpack libraries. +If you need other libraries (like MPI), you must add them alongside arpack (see CMake example below). + +Typically, if you need + +- ARPACK: at compile/link time, you'll need to provide BLAS and LAPACK. + +- ARPACK with eigen support (arpackSolver): at compile/link time, you'll need to provide BLAS, LAPACK and Eigen. + +- PARPACK: at compile/link time, you'll need to provide BLAS, LAPACK and MPI. + +Examples are provided in `tstCMakeInstall.sh` and `tstAutotoolsInstall.sh` generated after running cmake/configure. + ### With autotools First, set `PKG_CONFIG_PATH` to the location in the installation directory where `arpack.pc` lies. @@ -314,9 +327,12 @@ To use PARPACK in your Cmake builds, use `PARPACK::PARPACK` target: ```cmake FIND_PACKAGE(arpackng) +FIND_PACKAGE(MPI REQUIRED COMPONENTS Fortran) ADD_EXECUTABLE(main main.f) TARGET_INCLUDE_DIRECTORIES(main PUBLIC PARPACK::PARPACK) TARGET_LINK_LIBRARIES(main PARPACK::PARPACK) +TARGET_INCLUDE_DIRECTORIES(main PUBLIC MPI::MPI_Fortran) +TARGET_LINK_LIBRARIES(main MPI::MPI_Fortran) ``` Note: Make sure to update `CMAKE_MODULE_PATH` env variable (otheriwse, `find_package` won't find arpack-ng cmake file). diff --git a/cmake/tstCMakeInstall.sh.in b/cmake/tstCMakeInstall.sh.in index 747b5eee7..f22a1f24d 100755 --- a/cmake/tstCMakeInstall.sh.in +++ b/cmake/tstCMakeInstall.sh.in @@ -17,7 +17,7 @@ export LIBSUFFIX="${1%-*}" echo "LIBSUFFIX: $LIBSUFFIX" export ITF64SUFFIX="${1#*-}" echo "ITF64SUFFIX: $ITF64SUFFIX" -cmake -DCMAKE_INSTALL_PREFIX="${TMP_PREFIX}" -DMPI=ON -DLIBSUFFIX="${LIBSUFFIX}" -DITF64SUFFIX="${ITF64SUFFIX}" . +cmake -DCMAKE_INSTALL_PREFIX="${TMP_PREFIX}" -DMPI=ON -DICB=ON -DEIGEN=ON -DLIBSUFFIX="${LIBSUFFIX}" -DITF64SUFFIX="${ITF64SUFFIX}" . make all install tree "${TMP_PREFIX}" @@ -34,24 +34,32 @@ arpack_cmake_dir="${arpack_cmake_dir%/*}" # Same as dirname CMAKE_PREFIX_PATH="${arpack_cmake_dir%/*}" # cmake directory # 4. Create new cmake project, in temporary directory, with files from arpack-ng. +# The first targets are compiled with *.cmake files generated by cmake. +# The second targets are compiled with *.pc files generated by cmake. mkdir -p tstCMakeInstall cd tstCMakeInstall cp "@PROJECT_SOURCE_DIR@/EXAMPLES/BAND/dnband.f" . cp "@PROJECT_SOURCE_DIR@/EXAMPLES/BAND/dnbdr1.f" . -cp "@PROJECT_SOURCE_DIR@/EXAMPLES/BAND/dnbdr3.f" . cp "@PROJECT_SOURCE_DIR@/PARPACK/EXAMPLES/MPI/pdndrv1.f" . -cp "@PROJECT_SOURCE_DIR@/PARPACK/EXAMPLES/MPI/pdndrv3.f" . +cp "@PROJECT_SOURCE_DIR@/TESTS/icb_arpack_c.c" . +cp "@PROJECT_SOURCE_DIR@/TESTS/icb_arpack_cpp.cpp" . +cp "@PROJECT_SOURCE_DIR@/PARPACK/TESTS/MPI/icb_parpack_c.c" . +cp "@PROJECT_SOURCE_DIR@/PARPACK/TESTS/MPI/icb_parpack_cpp.cpp" . +cp "@PROJECT_SOURCE_DIR@/EXAMPLES/MATRIX_MARKET/arpackmm.cpp" . -echo "cmake_minimum_required(VERSION 3.0)" > CMakeLists.txt +echo "cmake_minimum_required(VERSION 3.5)" > CMakeLists.txt echo "" >> CMakeLists.txt -echo "project(tstCMakeInstall Fortran)" >> CMakeLists.txt +echo "project(tstCMakeInstall Fortran C CXX)" >> CMakeLists.txt +echo "" >> CMakeLists.txt +echo "# Targets compiled with *.cmake files generated by cmake" >> CMakeLists.txt echo "" >> CMakeLists.txt echo "find_package(BLAS REQUIRED)" >> CMakeLists.txt echo "find_package(LAPACK REQUIRED)" >> CMakeLists.txt -echo "find_package(MPI REQUIRED COMPONENTS Fortran)" >> CMakeLists.txt +echo "find_package(MPI REQUIRED COMPONENTS Fortran C CXX)" >> CMakeLists.txt echo "find_package(arpackng REQUIRED)" >> CMakeLists.txt +echo "find_package(Eigen3 3.3 REQUIRED)" >> CMakeLists.txt echo "" >> CMakeLists.txt echo "add_executable(dnbdr1 dnband.f dnbdr1.f)" >> CMakeLists.txt echo "target_include_directories(dnbdr1 INTERFACE BLAS::BLAS)" >> CMakeLists.txt @@ -60,6 +68,32 @@ echo "target_include_directories(dnbdr1 INTERFACE LAPACK::LAPACK)" >> CMake echo "target_link_libraries(dnbdr1 LAPACK::LAPACK)" >> CMakeLists.txt echo "target_include_directories(dnbdr1 INTERFACE ARPACK::ARPACK)" >> CMakeLists.txt echo "target_link_libraries(dnbdr1 ARPACK::ARPACK)" >> CMakeLists.txt +echo "" >> CMakeLists.txt +echo "add_executable(icb_arpack_c icb_arpack_c.c)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_c INTERFACE BLAS::BLAS)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_c BLAS::BLAS)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_c INTERFACE LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_c LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_c INTERFACE ARPACK::ARPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_c ARPACK::ARPACK)" >> CMakeLists.txt +echo "" >> CMakeLists.txt +echo "add_executable(icb_arpack_cpp icb_arpack_cpp.cpp)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_cpp INTERFACE BLAS::BLAS)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_cpp BLAS::BLAS)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_cpp INTERFACE LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_cpp LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_cpp INTERFACE ARPACK::ARPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_cpp ARPACK::ARPACK)" >> CMakeLists.txt +echo "" >> CMakeLists.txt +echo "add_executable(arpackmm arpackmm.cpp)" >> CMakeLists.txt +echo "target_include_directories(arpackmm INTERFACE BLAS::BLAS)" >> CMakeLists.txt +echo "target_link_libraries(arpackmm BLAS::BLAS)" >> CMakeLists.txt +echo "target_include_directories(arpackmm INTERFACE LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_link_libraries(arpackmm LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_include_directories(arpackmm INTERFACE ARPACK::ARPACK)" >> CMakeLists.txt +echo "target_link_libraries(arpackmm ARPACK::ARPACK)" >> CMakeLists.txt +echo "target_include_directories(arpackmm INTERFACE Eigen3::Eigen)" >> CMakeLists.txt +echo "target_link_libraries(arpackmm Eigen3::Eigen)" >> CMakeLists.txt echo "" >> CMakeLists.txt echo "add_executable(pdndrv1 dnband.f pdndrv1.f)" >> CMakeLists.txt echo "target_include_directories(pdndrv1 INTERFACE BLAS::BLAS)" >> CMakeLists.txt @@ -72,30 +106,96 @@ echo "target_include_directories(pdndrv1 INTERFACE ARPACK::ARPACK)" >> CMake echo "target_link_libraries(pdndrv1 ARPACK::ARPACK)" >> CMakeLists.txt echo "target_include_directories(pdndrv1 INTERFACE PARPACK::PARPACK)" >> CMakeLists.txt echo "target_link_libraries(pdndrv1 PARPACK::PARPACK)" >> CMakeLists.txt +echo "" >> CMakeLists.txt +echo "add_executable(icb_parpack_c icb_parpack_c.c)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_c INTERFACE BLAS::BLAS)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_c BLAS::BLAS)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_c INTERFACE LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_c LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_c INTERFACE MPI::MPI_C)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_c MPI::MPI_C)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_c INTERFACE ARPACK::ARPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_c ARPACK::ARPACK)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_c INTERFACE PARPACK::PARPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_c PARPACK::PARPACK)" >> CMakeLists.txt +echo "" >> CMakeLists.txt +echo "add_executable(icb_parpack_cpp icb_parpack_cpp.cpp)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_cpp INTERFACE BLAS::BLAS)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_cpp BLAS::BLAS)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_cpp INTERFACE LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_cpp LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_cpp INTERFACE MPI::MPI_CXX)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_cpp MPI::MPI_CXX)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_cpp INTERFACE ARPACK::ARPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_cpp ARPACK::ARPACK)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_cpp INTERFACE PARPACK::PARPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_cpp PARPACK::PARPACK)" >> CMakeLists.txt +echo "" >> CMakeLists.txt +echo "# Targets compiled with with *.pc files generated by cmake" >> CMakeLists.txt echo "" >> CMakeLists.txt echo "find_package(PkgConfig REQUIRED)" >> CMakeLists.txt echo "pkg_check_modules(ARPACK IMPORTED_TARGET REQUIRED arpack${LIBSUFFIX}${ITF64SUFFIX})" >> CMakeLists.txt echo "pkg_check_modules(PARPACK IMPORTED_TARGET REQUIRED parpack${LIBSUFFIX}${ITF64SUFFIX})" >> CMakeLists.txt -echo "" >> CMakeLists.txt -echo "add_executable(dnbdr3 dnband.f dnbdr3.f)" >> CMakeLists.txt -echo "target_include_directories(dnbdr3 INTERFACE BLAS::BLAS)" >> CMakeLists.txt -echo "target_link_libraries(dnbdr3 BLAS::BLAS)" >> CMakeLists.txt -echo "target_include_directories(dnbdr3 INTERFACE LAPACK::LAPACK)" >> CMakeLists.txt -echo "target_link_libraries(dnbdr3 LAPACK::LAPACK)" >> CMakeLists.txt -echo "target_include_directories(dnbdr3 INTERFACE PkgConfig::ARPACK)" >> CMakeLists.txt -echo "target_link_libraries(dnbdr3 PkgConfig::ARPACK)" >> CMakeLists.txt -echo "" >> CMakeLists.txt -echo "add_executable(pdndrv3 dnband.f pdndrv3.f)" >> CMakeLists.txt -echo "target_include_directories(pdndrv3 INTERFACE BLAS::BLAS)" >> CMakeLists.txt -echo "target_link_libraries(pdndrv3 BLAS::BLAS)" >> CMakeLists.txt -echo "target_include_directories(pdndrv3 INTERFACE LAPACK::LAPACK)" >> CMakeLists.txt -echo "target_link_libraries(pdndrv3 LAPACK::LAPACK)" >> CMakeLists.txt -echo "target_include_directories(pdndrv3 INTERFACE MPI::MPI_Fortran)" >> CMakeLists.txt -echo "target_link_libraries(pdndrv3 MPI::MPI_Fortran)" >> CMakeLists.txt -echo "target_include_directories(pdndrv3 INTERFACE PkgConfig::ARPACK)" >> CMakeLists.txt -echo "target_link_libraries(pdndrv3 PkgConfig::ARPACK)" >> CMakeLists.txt -echo "target_include_directories(pdndrv3 INTERFACE PkgConfig::PARPACK)" >> CMakeLists.txt -echo "target_link_libraries(pdndrv3 PkgConfig::PARPACK)" >> CMakeLists.txt +echo "" >> CMakeLists.txt +echo "add_executable(dnbdr1_pkg dnband.f dnbdr1.f)" >> CMakeLists.txt +echo "target_include_directories(dnbdr1_pkg INTERFACE BLAS::BLAS)" >> CMakeLists.txt +echo "target_link_libraries(dnbdr1_pkg BLAS::BLAS)" >> CMakeLists.txt +echo "target_include_directories(dnbdr1_pkg INTERFACE LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_link_libraries(dnbdr1_pkg LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_include_directories(dnbdr1_pkg INTERFACE PkgConfig::ARPACK)" >> CMakeLists.txt +echo "target_link_libraries(dnbdr1_pkg PkgConfig::ARPACK)" >> CMakeLists.txt +echo "" >> CMakeLists.txt +echo "add_executable(icb_arpack_c_pkg icb_arpack_c.c)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_c_pkg INTERFACE BLAS::BLAS)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_c_pkg BLAS::BLAS)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_c_pkg INTERFACE LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_c_pkg LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_c_pkg INTERFACE PkgConfig::ARPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_c_pkg PkgConfig::ARPACK)" >> CMakeLists.txt +echo "" >> CMakeLists.txt +echo "add_executable(icb_arpack_cpp_pkg icb_arpack_cpp.cpp)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_cpp_pkg INTERFACE BLAS::BLAS)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_cpp_pkg BLAS::BLAS)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_cpp_pkg INTERFACE LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_cpp_pkg LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_cpp_pkg INTERFACE PkgConfig::ARPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_cpp_pkg PkgConfig::ARPACK)" >> CMakeLists.txt +echo "" >> CMakeLists.txt +echo "add_executable(pdndrv1_pkg dnband.f pdndrv1.f)" >> CMakeLists.txt +echo "target_include_directories(pdndrv1_pkg INTERFACE BLAS::BLAS)" >> CMakeLists.txt +echo "target_link_libraries(pdndrv1_pkg BLAS::BLAS)" >> CMakeLists.txt +echo "target_include_directories(pdndrv1_pkg INTERFACE LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_link_libraries(pdndrv1_pkg LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_include_directories(pdndrv1_pkg INTERFACE MPI::MPI_Fortran)" >> CMakeLists.txt +echo "target_link_libraries(pdndrv1_pkg MPI::MPI_Fortran)" >> CMakeLists.txt +echo "target_include_directories(pdndrv1_pkg INTERFACE PkgConfig::ARPACK)" >> CMakeLists.txt +echo "target_link_libraries(pdndrv1_pkg PkgConfig::ARPACK)" >> CMakeLists.txt +echo "target_include_directories(pdndrv1_pkg INTERFACE PkgConfig::PARPACK)" >> CMakeLists.txt +echo "target_link_libraries(pdndrv1_pkg PkgConfig::PARPACK)" >> CMakeLists.txt +echo "" >> CMakeLists.txt +echo "add_executable(icb_parpack_c_pkg icb_parpack_c.c)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_c_pkg INTERFACE BLAS::BLAS)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_c_pkg BLAS::BLAS)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_c_pkg INTERFACE LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_c_pkg LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_c_pkg INTERFACE MPI::MPI_C)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_c_pkg MPI::MPI_C)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_c_pkg INTERFACE PkgConfig::ARPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_c_pkg PkgConfig::ARPACK)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_c_pkg INTERFACE PkgConfig::PARPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_c_pkg PkgConfig::PARPACK)" >> CMakeLists.txt +echo "" >> CMakeLists.txt +echo "add_executable(icb_parpack_cpp_pkg icb_parpack_cpp.cpp)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_cpp_pkg INTERFACE BLAS::BLAS)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_cpp_pkg BLAS::BLAS)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_cpp_pkg INTERFACE LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_cpp_pkg LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_cpp_pkg INTERFACE MPI::MPI_CXX)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_cpp_pkg MPI::MPI_CXX)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_cpp_pkg INTERFACE PkgConfig::ARPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_cpp_pkg PkgConfig::ARPACK)" >> CMakeLists.txt +echo "target_include_directories(icb_parpack_cpp_pkg INTERFACE PkgConfig::PARPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_parpack_cpp_pkg PkgConfig::PARPACK)" >> CMakeLists.txt # 5. Build and test this new project with cmake: for this to be possible, find_package must work. @@ -105,7 +205,21 @@ cd build cmake .. -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" || exit 1 make all VERBOSE=1 || exit 1 +export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/tmp/tstCMakeInstall/local/lib" + +# The first targets are compiled with *.cmake files generated by cmake. ./dnbdr1 || exit 1 +./icb_arpack_c || exit 1 +./icb_arpack_cpp || exit 1 +./arpackmm -h || exit 1 mpirun -n 2 ./pdndrv1 || exit 1 -./dnbdr3 || exit 1 -mpirun -n 2 ./pdndrv3 || exit 1 +mpirun -n 2 ./icb_parpack_c || exit 1 +mpirun -n 2 ./icb_parpack_cpp || exit 1 + +# The second targets are compiled with *.pc files generated by cmake. +./dnbdr1_pkg || exit 1 +./icb_arpack_c_pkg || exit 1 +./icb_arpack_cpp_pkg || exit 1 +mpirun -n 2 ./pdndrv1_pkg || exit 1 +mpirun -n 2 ./icb_parpack_c_pkg || exit 1 +mpirun -n 2 ./icb_parpack_cpp_pkg || exit 1 diff --git a/configure.ac b/configure.ac index e8cccdc4f..4c43bab51 100644 --- a/configure.ac +++ b/configure.ac @@ -349,7 +349,6 @@ AC_SUBST([PARPACK_PC_LIBS_PRIVATE], ["$LAPACK_LIBS $BLAS_LIBS $MPI_Fortran_LIBS" AC_CONFIG_FILES([ arpack$LIBSUFFIX$ITF64SUFFIX.pc:pkg-config/arpack.pc.in parpack$LIBSUFFIX$ITF64SUFFIX.pc:pkg-config/parpack.pc.in - arpackSolver$LIBSUFFIX$ITF64SUFFIX.pc:pkg-config/arpackSolver.pc.in ], [], [LIBSUFFIX="$LIBSUFFIX"; ITF64SUFFIX="$ITF64SUFFIX"]) dnl We do NOT want arpackng*.cmake files to be created: @MPI@ can not be replaced. diff --git a/pkg-config/arpackSolver.pc.in b/pkg-config/arpackSolver.pc.in deleted file mode 100644 index 8bffa75c7..000000000 --- a/pkg-config/arpackSolver.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -includedir=@includedir@/arpack@ITF64SUFFIX@ - -Name: arpackSolver -Description: Utility to test arpack with matrix market files -Version: @PACKAGE_VERSION@ -URL: @PACKAGE_URL@ -Requires: arpack, eigen3 >= 3.3 -Cflags: -I${includedir} diff --git a/pkg-config/tstAutotoolsInstall.sh.in b/pkg-config/tstAutotoolsInstall.sh.in index 544b66358..31d16e699 100755 --- a/pkg-config/tstAutotoolsInstall.sh.in +++ b/pkg-config/tstAutotoolsInstall.sh.in @@ -1,6 +1,6 @@ #!/bin/bash -eu # Testing that PKG_CHECK_MODULES works. -# Note: this script must not be added to the test suite as it will change cmake options. +# Note: this script must not be added to the test suite as it will change configure options. echo "***************************************************************************************" @@ -10,8 +10,8 @@ export TMP_DIR="/tmp/tstAutotoolsInstall" rm -fr "${TMP_DIR}" # Make sure we restart from scratch. mkdir -p "${TMP_DIR}" -# 2. Rerun cmake with prefix, install arpack-ng. -# Note: this script must not be added to the test suite as it will change cmake options. +# 2. Rerun autotools with prefix, install arpack-ng. +# Note: this script must not be added to the test suite as it will change configure options. make clean make distclean @@ -22,7 +22,7 @@ export LIBSUFFIX="${1%-*}" echo "LIBSUFFIX: $LIBSUFFIX" export ITF64SUFFIX="${1#*-}" echo "ITF64SUFFIX: $ITF64SUFFIX" -LIBSUFFIX="${LIBSUFFIX}" ITF64SUFFIX="${ITF64SUFFIX}" ./configure --prefix="${TMP_PREFIX}" --enable-mpi +LIBSUFFIX="${LIBSUFFIX}" ITF64SUFFIX="${ITF64SUFFIX}" ./configure --prefix="${TMP_PREFIX}" --enable-mpi --enable-icb --enable-eigen make all install tree "${TMP_PREFIX}" @@ -33,7 +33,7 @@ export PKG_CONFIG_PATH="$(find ${TMP_PREFIX} -name arpack${LIBSUFFIX}${ITF64SUFF export PKG_CONFIG_PATH="${PKG_CONFIG_PATH%/*}" # Same as dirname. echo "PKG_CONFIG_PATH: $PKG_CONFIG_PATH" -# 4. Create new cmake project, in temporary directory, with files from arpack-ng. +# 4. Create new autotools project, in temporary directory, with files from arpack-ng. mkdir -p tstAutotoolsInstall cd tstAutotoolsInstall @@ -42,6 +42,11 @@ cp "${PROJECT_SOURCE_DIR}/EXAMPLES/BAND/dnband.f" . cp "${PROJECT_SOURCE_DIR}/EXAMPLES/BAND/dnbdr1.f" . cp "${PROJECT_SOURCE_DIR}/PARPACK/EXAMPLES/MPI/pdndrv1.f" . cp -fr "${PROJECT_SOURCE_DIR}/m4" . +cp "${PROJECT_SOURCE_DIR}/TESTS/icb_arpack_c.c" . +cp "${PROJECT_SOURCE_DIR}/TESTS/icb_arpack_cpp.cpp" . +cp "${PROJECT_SOURCE_DIR}/PARPACK/TESTS/MPI/icb_parpack_c.c" . +cp "${PROJECT_SOURCE_DIR}/PARPACK/TESTS/MPI/icb_parpack_cpp.cpp" . +cp "${PROJECT_SOURCE_DIR}/EXAMPLES/MATRIX_MARKET/arpackmm.cpp" . echo "AC_PREREQ([2.68]) " > configure.ac echo "AC_INIT([tstAutotoolsInstall], 1.0) " >> configure.ac @@ -49,6 +54,8 @@ echo "AM_INIT_AUTOMAKE([foreign]) " echo "AC_CONFIG_MACRO_DIR([m4]) " >> configure.ac echo " " >> configure.ac echo "AC_PROG_FC " >> configure.ac +echo "AC_PROG_CC " >> configure.ac +echo "AC_PROG_CXX " >> configure.ac echo "AC_PROG_MKDIR_P " >> configure.ac echo "AC_PROG_MAKE_SET " >> configure.ac echo "PKG_PROG_PKG_CONFIG " >> configure.ac @@ -64,6 +71,20 @@ echo "AX_MPI([], AC_MSG_ERROR([could not compile a Fortran MPI test program]))" echo "F77=\$MPIF77 " >> configure.ac echo "AC_SUBST([MPI_Fortran_LIBS]) " >> configure.ac echo " " >> configure.ac +echo "AC_LANG_PUSH([C]) " >> configure.ac +echo "AX_MPI([], AC_MSG_ERROR([could not compile a C MPI test program])) " >> configure.ac +echo "AC_SUBST([MPI_C_LIBS], ["\$MPILIBS \$FCLIBS"]) " >> configure.ac +echo "CC=\$MPICC " >> configure.ac +echo "AC_LANG_POP([C]) " >> configure.ac +echo " " >> configure.ac +echo "AC_LANG_PUSH([C++]) " >> configure.ac +echo "AX_MPI([], AC_MSG_ERROR([could not compile a C++ MPI test program])) " >> configure.ac +echo "AC_SUBST([MPI_CXX_LIBS], ["\$MPILIBS \$FCLIBS"]) " >> configure.ac +echo "CXX=\$MPICXX " >> configure.ac +echo "AC_LANG_POP([C++]) " >> configure.ac +echo " " >> configure.ac +echo "PKG_CHECK_MODULES([EIGEN3], [eigen3 >= 3.3]) " >> configure.ac +echo " " >> configure.ac echo "PKG_CHECK_MODULES([ARPACK], [arpack${LIBSUFFIX}${ITF64SUFFIX}]) " >> configure.ac echo "AC_SUBST([ARPACK_CFLAGS]) " >> configure.ac echo "AC_SUBST([ARPACK_LIBS]) " >> configure.ac @@ -82,7 +103,7 @@ echo "ACLOCAL_AMFLAGS = -I m4 echo " " >> Makefile.am echo "EXTRA_DIST = debug.h stat.h " >> Makefile.am echo " " >> Makefile.am -echo "bin_PROGRAMS = dnbdr1 pdndrv1 " >> Makefile.am +echo "bin_PROGRAMS = dnbdr1 pdndrv1 icb_arpack_c icb_arpack_cpp icb_parpack_c icb_parpack_cpp arpackmm " >> Makefile.am echo " " >> Makefile.am echo "dnbdr1_SOURCES = dnbdr1.f dnband.f " >> Makefile.am echo "dnbdr1_FFLAGS = \$(ARPACK_CFLAGS) " >> Makefile.am @@ -91,13 +112,41 @@ echo " echo "pdndrv1_SOURCES = pdndrv1.f dnband.f " >> Makefile.am echo "pdndrv1_FFLAGS = \$(PARPACK_CFLAGS) \$(ARPACK_CFLAGS) " >> Makefile.am echo "pdndrv1_LDADD = \$(PARPACK_LIBS) \$(ARPACK_LIBS) \$(LAPACK_LIBS) \$(BLAS_LIBS) \$(MPI_Fortran_LIBS)" >> Makefile.am +echo " " >> Makefile.am +echo "icb_arpack_c_SOURCES = icb_arpack_c.c " >> Makefile.am +echo "icb_arpack_c_CPPFLAGS = \$(ARPACK_CFLAGS) " >> Makefile.am +echo "icb_arpack_c_LDADD = \$(ARPACK_LIBS) \$(LAPACK_LIBS) \$(BLAS_LIBS) " >> Makefile.am +echo " " >> Makefile.am +echo "icb_arpack_cpp_SOURCES = icb_arpack_cpp.cpp " >> Makefile.am +echo "icb_arpack_cpp_CPPFLAGS = \$(ARPACK_CFLAGS) " >> Makefile.am +echo "icb_arpack_cpp_LDADD = \$(ARPACK_LIBS) \$(LAPACK_LIBS) \$(BLAS_LIBS) " >> Makefile.am +echo " " >> Makefile.am +echo "arpackmm_SOURCES = arpackmm.cpp " >> Makefile.am +echo "arpackmm_CPPFLAGS = \$(ARPACK_CFLAGS) \$(EIGEN3_CFLAGS) " >> Makefile.am +echo "arpackmm_LDADD = \$(ARPACK_LIBS) \$(LAPACK_LIBS) \$(BLAS_LIBS) " >> Makefile.am +echo " " >> Makefile.am +echo "icb_parpack_c_SOURCES = icb_parpack_c.c " >> Makefile.am +echo "icb_parpack_c_CPPFLAGS = \$(AM_CPPFLAGS) \$(PARPACK_CFLAGS) \$(ARPACK_CFLAGS) " >> Makefile.am +echo "icb_parpack_c_LDADD = \$(PARPACK_LIBS) \$(ARPACK_LIBS) \$(LAPACK_LIBS) \$(BLAS_LIBS) \$(MPI_C_LIBS) " >> Makefile.am +echo " " >> Makefile.am +echo "icb_parpack_cpp_SOURCES = icb_parpack_cpp.cpp " >> Makefile.am +echo "icb_parpack_cpp_CPPFLAGS = \$(AM_CPPFLAGS) \$(PARPACK_CFLAGS) \$(ARPACK_CFLAGS) " >> Makefile.am +echo "icb_parpack_cpp_LDADD = \$(PARPACK_LIBS) \$(ARPACK_LIBS) \$(LAPACK_LIBS) \$(BLAS_LIBS) \$(MPI_CXX_LIBS) " >> Makefile.am -# 5. Build and test this new project with cmake: for this to be possible, PKG_CHECK_MODULES must work. +# 5. Build and test this new project with configure: for this to be possible, PKG_CHECK_MODULES must work. autoreconf --force --verbose --install -./configure -make all +./configure || exit 1 +make all || exit 1 + +export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/tmp/tstAutotoolsInstall/local/lib" + +./dnbdr1 || exit 1 +./icb_arpack_c || exit 1 +./icb_arpack_cpp || exit 1 +./arpackmm -h || exit 1 -./dnbdr1 -mpirun -n 2 ./pdndrv1 +mpirun -n 2 ./pdndrv1 || exit 1 +mpirun -n 2 ./icb_parpack_c || exit 1 +mpirun -n 2 ./icb_parpack_cpp || exit 1