Skip to content

Commit

Permalink
dependency management enhancements.
Browse files Browse the repository at this point in the history
  • Loading branch information
shahmoradi committed Apr 21, 2024
1 parent ab20f25 commit aa203b6
Show file tree
Hide file tree
Showing 21 changed files with 65 additions and 22 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ if (TRUE)
set(bdir "${CMAKE_BINARY_DIR}")
set(paramonte_bld_dir "${bdir}")
set(ENV{paramonte_bld_dir} "${paramonte_bld_dir}")
set(CMAKE_INSTALL_PREFIX "${paramonte_bld_dir}" CACHE BOOL "ParaMonte/OpenBLAS/dependencies install directory prefix." FORCE)
message(NOTICE "${pmattn} All build files will be stored at paramonte_bld_dir=\"${paramonte_bld_dir}\"")

#### Purge files or folders within the build folder if requested.
Expand Down Expand Up @@ -721,7 +722,8 @@ if (TRUE)
endif()
#set(USE_THREAD ${OMP_ENABLED} CACHE BOOL "OpenBLAS threading." FORCE)
set(USE_THREAD 1 CACHE BOOL "OpenBLAS threading." FORCE)
set(CMAKE_INSTALL_PREFIX "${paramonte_bld_dir}" CACHE BOOL "OpenBLAS install directory." FORCE)
# The following install prefix is now set globally for the entire project.
#set(CMAKE_INSTALL_PREFIX "${paramonte_bld_dir}" CACHE BOOL "OpenBLAS install directory." FORCE)
# setup openblas files directory
set(paramonte_bld_obl_dir "${paramonte_bld_dir}/obl")
message(NOTICE "${pmattn} paramonte_bld_obl_dir: ${paramonte_bld_obl_dir}")
Expand Down
2 changes: 1 addition & 1 deletion benchmark/fortran/build.gnu.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
gfortran -cpp -O3 -ffree-line-length-none -Wl,-rpath,../../../../lib -I../../../../inc -o main.exe main.F90 ../../../../lib/libparamonte_fortran_*_gnu*.so && ./main.exe
gfortran -cpp -O3 -ffree-line-length-none -Wl,-rpath,../../../../lib -I../../../../inc -o main.exe main.F90 ../../../../lib/libparamonte*.so && ./main.exe
2 changes: 1 addition & 1 deletion benchmark/fortran/build.intel.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../../lib -I../../../../inc -o main.exe main.F90 ../../../../lib/libparamonte_fortran_*_intel*.so && ./main.exe || exit 1
ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../../lib -I../../../../inc -o main.exe main.F90 ../../../../lib/libparamonte*.so && ./main.exe || exit 1
2 changes: 1 addition & 1 deletion example/fortran/build.gnu.debug.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
del main.exe
set PATH=..\..\..\lib;%PATH%
gfortran -cpp -ffree-line-length-none -O0 -g -fcheck=all -fbacktrace -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte_fortran_*_gnu* -o main.exe
gfortran -cpp -ffree-line-length-none -O0 -g -fcheck=all -fbacktrace -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
main.exe
2 changes: 1 addition & 1 deletion example/fortran/build.gnu.debug.mpi.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
del main.exe
set PATH=..\..\..\lib;%PATH%
gfortran -cpp -ffree-line-length-none -O0 -g -fcheck=all -fbacktrace -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte_fortran_*_gnu* -o main.exe
gfortran -cpp -ffree-line-length-none -O0 -g -fcheck=all -fbacktrace -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
mpiexec -n 3 main.exe
2 changes: 1 addition & 1 deletion example/fortran/build.gnu.debug.mpi.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
rm main.exe
gfortran -cpp -ffree-line-length-none -O0 -g -fcheck=all -fbacktrace -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte_fortran_*_gnu* -o main.exe
gfortran -cpp -ffree-line-length-none -O0 -g -fcheck=all -fbacktrace -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
mpiexec -n 3 ./main.exe
2 changes: 1 addition & 1 deletion example/fortran/build.gnu.debug.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
rm main.exe
gfortran -cpp -ffree-line-length-none -O0 -g -fcheck=all -fbacktrace -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte_fortran_*_gnu* -o main.exe
gfortran -cpp -ffree-line-length-none -O0 -g -fcheck=all -fbacktrace -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
./main.exe
2 changes: 1 addition & 1 deletion example/fortran/build.gnu.release.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
del main.exe
set PATH=..\..\..\lib;%PATH%
gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte_fortran_*_gnu* -o main.exe
gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
main.exe
2 changes: 1 addition & 1 deletion example/fortran/build.gnu.release.mpi.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
del main.exe
set PATH=..\..\..\lib;%PATH%
gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte_fortran_*_gnu* -o main.exe
gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
mpiexec -n 3 main.exe
2 changes: 1 addition & 1 deletion example/fortran/build.gnu.release.mpi.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
rm main.exe
gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte_fortran_*_gnu* -o main.exe
gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
mpiexec -n 3 ./main.exe
2 changes: 1 addition & 1 deletion example/fortran/build.gnu.release.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
rm main.exe
gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte_fortran_*_gnu* -o main.exe
gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
./main.exe
2 changes: 1 addition & 1 deletion example/fortran/build.intel.debug.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
del main.exe
set PATH=..\..\..\lib;%PATH%
ifort /fpp /standard-semantics /Od /debug:full /CB /Qinit:snan,arrays /warn:all /gen-interfaces /traceback /check:all /fpe-all:0 /Qtrapuv /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte_fortran_*_intel*.lib /exe:main.exe
ifort /fpp /standard-semantics /Od /debug:full /CB /Qinit:snan,arrays /warn:all /gen-interfaces /traceback /check:all /fpe-all:0 /Qtrapuv /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
main.exe
2 changes: 1 addition & 1 deletion example/fortran/build.intel.debug.mpi.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
del main.exe
set PATH=..\..\..\lib;%PATH%
ifort /fpp /standard-semantics /Od /debug:full /CB /Qinit:snan,arrays /warn:all /gen-interfaces /traceback /check:all /fpe-all:0 /Qtrapuv /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte_fortran_*_intel*.lib /exe:main.exe
ifort /fpp /standard-semantics /Od /debug:full /CB /Qinit:snan,arrays /warn:all /gen-interfaces /traceback /check:all /fpe-all:0 /Qtrapuv /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
mpiexec -localonly -n 3 main.exe
2 changes: 1 addition & 1 deletion example/fortran/build.intel.debug.mpi.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
rm main.exe
ifort -fpp -standard-semantics -O0 -g3 -CB -debug full -traceback -check all -fpe0 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte_fortran_*_intel* -o main.exe
ifort -fpp -standard-semantics -O0 -g3 -CB -debug full -traceback -check all -fpe0 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
mpiexec -n 3 ./main.exe
2 changes: 1 addition & 1 deletion example/fortran/build.intel.debug.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
rm main.exe
ifort -fpp -standard-semantics -O0 -g3 -CB -debug full -traceback -check all -fpe0 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte_fortran_*_intel* -o main.exe
ifort -fpp -standard-semantics -O0 -g3 -CB -debug full -traceback -check all -fpe0 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
./main.exe
2 changes: 1 addition & 1 deletion example/fortran/build.intel.release.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
del main.exe
set PATH=..\..\..\lib;%PATH%
ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte_fortran_*_intel*.lib /exe:main.exe
ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
main.exe
2 changes: 1 addition & 1 deletion example/fortran/build.intel.release.mpi.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
del main.exe
set PATH=..\..\..\lib;%PATH%
ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte_fortran_*_intel*.lib /exe:main.exe
ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
mpiexec -localonly -n 3 main.exe
2 changes: 1 addition & 1 deletion example/fortran/build.intel.release.mpi.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
rm main.exe
ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte_fortran_*_intel* -o main.exe
ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
mpiexec -n 3 ./main.exe
2 changes: 1 addition & 1 deletion example/fortran/build.intel.release.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
rm main.exe
ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte_fortran_*_intel* -o main.exe
ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
./main.exe
2 changes: 1 addition & 1 deletion install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ if not "%1"=="" (

if "!FLAG!"=="--deps" (
set FLAG_SUPPORTED=true
set "flag_deps=-Dblas=!VALUE!"
set "flag_deps=-Ddeps=!VALUE!"
if "!VALUE!"=="" set "VALUE_SUPPORTED=false"
if /i "!VALUE:~0,2!"=="--" set "VALUE_SUPPORTED=false"
shift
Expand Down
45 changes: 43 additions & 2 deletions src/fortran/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -969,9 +969,50 @@ set_source_files_properties("${paramonte_src_main_c_paths}" PROPERTIES COMPILE_D

install(TARGETS "${libname}"
CONFIGURATIONS "${CMAKE_BUILD_TYPE}"
DESTINATION "${paramonte_bld_lib_dir}/"
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
)

#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Recipe for installing the runtime dependencies.
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if (DLL_ENABLED AND DEPS_ENABLED)
install(CODE [[
function(install_library_with_deps LIBRARY)
file(INSTALL
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
TYPE SHARED_LIBRARY
FOLLOW_SYMLINK_CHAIN
FILES "${LIBRARY}"
)
file(GET_RUNTIME_DEPENDENCIES
LIBRARIES ${LIBRARY}
RESOLVED_DEPENDENCIES_VAR resolved_deps
UNRESOLVED_DEPENDENCIES_VAR unresolved_deps
)
foreach(FILE ${resolved_deps})
if(NOT IS_SYMLINK ${FILE})
install_library_with_deps(${FILE})
endif()
endforeach()
foreach(FILE ${unresolved_deps})
message(STATUS "Unresolved from ${LIBRARY}: ${FILE}")
endforeach()
endfunction()
file(GET_RUNTIME_DEPENDENCIES
LIBRARIES $<TARGET_SONAME_FILE:libparamonte>
RESOLVED_DEPENDENCIES_VAR resolved_deps
UNRESOLVED_DEPENDENCIES_VAR unresolved_deps
)
foreach(FILE ${resolved_deps})
install_library_with_deps(${FILE})
endforeach()
foreach(FILE ${unresolved_deps})
message(STATUS "Unresolved: ${FILE}")
endforeach()
]])
endif()

#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Add the executable for build-time FPP source generation.
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Expand Down Expand Up @@ -1260,7 +1301,7 @@ endif()
# #setSubDirList(subDirList "${destin}")
# #foreach(subDir ${subDirList})
# # setSubDirList(subSubDirList "${destin}/${subDir}")
# # set(example_current_dir "../../../../lib/libparamonte_fortran_*_intel*.so")
# # set(example_current_dir "../../../../lib/libparamonte*.so")
# # foreach(subSubDir ${subSubDirList})
# # set(example_current_dir "${destin}/${subDir}/${subSubDir}")
# # message(NOTICE "${pmattn} Adding the build scripts to example at: ${example_current_dir}")
Expand Down

0 comments on commit aa203b6

Please sign in to comment.