Skip to content

Commit

Permalink
Fix installation tests: compile and run icb_arpack_c.
Browse files Browse the repository at this point in the history
  • Loading branch information
fghoussen committed Aug 12, 2023
1 parent c18d153 commit 1b525b6
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 13 deletions.
1 change: 1 addition & 0 deletions ICB/Makefile.am
Original file line number Diff line number Diff line change
@@ -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
Expand Down
26 changes: 24 additions & 2 deletions cmake/tstCMakeInstall.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 -DLIBSUFFIX="${LIBSUFFIX}" -DITF64SUFFIX="${ITF64SUFFIX}" .
make all install
tree "${TMP_PREFIX}"

Expand All @@ -34,6 +34,8 @@ 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
Expand All @@ -43,10 +45,11 @@ 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" .

echo "cmake_minimum_required(VERSION 3.0)" > CMakeLists.txt
echo "" >> CMakeLists.txt
echo "project(tstCMakeInstall Fortran)" >> CMakeLists.txt
echo "project(tstCMakeInstall Fortran C)" >> CMakeLists.txt
echo "" >> CMakeLists.txt
echo "find_package(BLAS REQUIRED)" >> CMakeLists.txt
echo "find_package(LAPACK REQUIRED)" >> CMakeLists.txt
Expand All @@ -60,6 +63,14 @@ 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(pdndrv1 dnband.f pdndrv1.f)" >> CMakeLists.txt
echo "target_include_directories(pdndrv1 INTERFACE BLAS::BLAS)" >> CMakeLists.txt
Expand All @@ -84,6 +95,14 @@ echo "target_include_directories(dnbdr3 INTERFACE LAPACK::LAPACK)" >> CMake
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(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(pdndrv3 dnband.f pdndrv3.f)" >> CMakeLists.txt
echo "target_include_directories(pdndrv3 INTERFACE BLAS::BLAS)" >> CMakeLists.txt
Expand All @@ -106,6 +125,9 @@ cmake .. -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" || exit 1
make all VERBOSE=1 || exit 1

./dnbdr1 || exit 1
./icb_arpack_c || exit 1
mpirun -n 2 ./pdndrv1 || exit 1

./dnbdr3 || exit 1
./icb_arpack_c_pkg || exit 1
mpirun -n 2 ./pdndrv3 || exit 1
28 changes: 17 additions & 11 deletions pkg-config/tstAutotoolsInstall.sh.in
Original file line number Diff line number Diff line change
@@ -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 "***************************************************************************************"

Expand All @@ -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
Expand All @@ -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
make all install
tree "${TMP_PREFIX}"

Expand All @@ -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
Expand All @@ -42,6 +42,7 @@ 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" .

echo "AC_PREREQ([2.68]) " > configure.ac
echo "AC_INIT([tstAutotoolsInstall], 1.0) " >> configure.ac
Expand Down Expand Up @@ -82,7 +83,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 " >> Makefile.am
echo " " >> Makefile.am
echo "dnbdr1_SOURCES = dnbdr1.f dnband.f " >> Makefile.am
echo "dnbdr1_FFLAGS = \$(ARPACK_CFLAGS) " >> Makefile.am
Expand All @@ -91,13 +92,18 @@ 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

# 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

./dnbdr1
mpirun -n 2 ./pdndrv1
./dnbdr1 || exit 1
./icb_arpack_c || exit 1
mpirun -n 2 ./pdndrv1 || exit 1

0 comments on commit 1b525b6

Please sign in to comment.