Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jobs:
libopenblas-dev \
liblapack-dev \
doxygen \
libgsl-dev \
libsuitesparse-dev \
libsuperlu-dev \
python3-dev \
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ make clean
- **LAPACK/BLAS** - Linear algebra
- **SuiteSparse** - Sparse matrix operations
- **HDF5** - Data storage
- **GSL** - GNU Scientific Library
- **fortnum** - Numerical core (special functions, quadrature, ODE, root finding)
- **SUNDIALS** - Numerical solvers

### Python Dependencies
Expand Down
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ project(KAMEL LANGUAGES C CXX Fortran)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# OpenMP is a project-wide dependency: -fopenmp is on the global compile flags
# below, and libneo objects in the KiLCA link closure use OMP critical sections
# (GOMP_critical_*). Resolve the imported target once at top scope so it is
# visible to every subdirectory and can ride on targets' PUBLIC link interfaces.
find_package(OpenMP REQUIRED COMPONENTS C Fortran)

# Set architecture flags based on platform
if(APPLE)
# On macOS, use libomp from Homebrew for OpenMP support
# find_package(OpenMP REQUIRED)
find_package(OpenMP REQUIRED C Fortran)

# Locate libomp from Homebrew
find_program(BREW_EXECUTABLE brew HINTS /opt/homebrew/bin /usr/local/bin)
if(BREW_EXECUTABLE)
Expand Down
2 changes: 1 addition & 1 deletion KIM/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is the integral plasma response model based on the code and model Kinetic L

### Required Libraries
- **LAPACK/BLAS** - Linear algebra
- **GSL** - GNU Scientific Library
- **fortnum** - Special functions (Bessel) and error function
- **HDF5** - Data storage (with Fortran bindings)
- **SuiteSparse** - Sparse matrix operations (UMFPACK)
- **SuperLU** - Sparse direct solver
Expand Down
9 changes: 1 addition & 8 deletions KIM/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ target_include_directories(KIM_lib PUBLIC "${CMAKE_BINARY_DIR}/OBJS/sparse/")
# fortnum provides the special functions (bessel_in) used by FLR2_asymptotics.
target_link_libraries(KIM_lib PUBLIC fortnum)

# TODO: unify this: either use the system library everywhere, or use the cloned version
# KiLCA uses the cloned libraries for now, QL-Balance the system libraries
find_package(GSL REQUIRED)
target_include_directories(KIM_lib PUBLIC "${GSL_INCLUDE_DIRS}")

find_package(LAPACK REQUIRED)
if("${LAPACK_FOUND}")
message(" ====== LAPACK was found! ======")
Expand Down Expand Up @@ -111,13 +106,11 @@ if("${SUPERLU_FOUND}")
endif()

set(KILCA_PATH ${CMAKE_SOURCE_DIR}/KiLCA)
set(KiLCA_lib_path ${CMAKE_SOURCE_DIR}/build/install/lib/libKiLCA_Lib_V_2.4.2_MDNO_FPGEN_POLYNOMIAL_Release_64bit.a)
# KiLCA is NOT linked to KIM_lib: KIM does not use any KiLCA symbols.
# Previously PUBLIC, this caused duplicate library linking when QL-Balance
# linked both KIM_lib and kilca_lib, corrupting symbol resolution order
# and breaking KiLCA's wave solver (besselj failures, vacuum stitching errors).
# KIM_exe links KiLCA directly via slatec (which provides the math routines).
target_link_libraries(KIM_lib PUBLIC GSL::gsl GSL::gslcblas)
target_include_directories(KIM_lib PUBLIC ${KILCA_PATH}/math/)

find_package(HDF5 COMPONENTS C Fortran HL REQUIRED)
Expand All @@ -141,7 +134,7 @@ set_target_properties(KIM_exe PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/install/bin/")
target_link_libraries(KIM_exe
KIM_lib
"${KiLCA_lib_path}"
kilca_lib
lapack
slatec
)
7 changes: 4 additions & 3 deletions KIM/src/math/ddeabm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ set(ddeabm_files
dsteps.f
)
add_library(ddeabm "${ddeabm_files}")
# ddeabm.f/ddes.f reference xermsg (and i1mach/d1mach via that path); those
# live in libslatec. Declare the dependency so the linker orders libslatec
# after libddeabm and resolves xermsg_ instead of dropping it.

# ddeabm calls the slatec error machinery (xermsg and friends); declare the
# dependency explicitly so the static-archive link order resolves xermsg_
# regardless of how the consuming executable orders its libraries.
target_link_libraries(ddeabm PUBLIC slatec)
25 changes: 13 additions & 12 deletions KIM/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# KiLCA library path (needed for tests that use KIM_lib symbols depending on KiLCA math)
set(KiLCA_lib_path ${CMAKE_SOURCE_DIR}/build/install/lib/libKiLCA_Lib_V_2.4.2_MDNO_FPGEN_POLYNOMIAL_Release_64bit.a)
# OpenMP runtime (GOMP_critical_* from libneo's OMP critical sections) is
# carried transitively by kilca_lib's PUBLIC link interface, so no per-target
# OpenMP linkage is needed here.

# Optional: build QUADPACK/RKF45 integration comparison test
add_executable(test_integration_methods ${CMAKE_SOURCE_DIR}/KIM/tests/test_integration_methods.f90)
set_target_properties(test_integration_methods PROPERTIES
OUTPUT_NAME test_integration_methods.x
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests/")
target_link_libraries(test_integration_methods KIM_lib "${KiLCA_lib_path}" lapack cerf ddeabm slatec)
target_link_libraries(test_integration_methods KIM_lib kilca_lib lapack cerf ddeabm slatec)
add_test(NAME test_integration_methods
COMMAND ${CMAKE_BINARY_DIR}/tests/test_integration_methods.x)

Expand Down Expand Up @@ -34,31 +35,31 @@ set_target_properties(test_profile_input PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests/")
# Links the full math set: using profile_input_m pulls KIM objects whose
# transitive deps (W2_arr) need the hypergeometric routines from KiLCA/slatec.
target_link_libraries(test_profile_input KIM_lib "${KiLCA_lib_path}" lapack cerf ddeabm slatec)
target_link_libraries(test_profile_input KIM_lib kilca_lib lapack cerf ddeabm slatec)
add_test(NAME test_profile_input
COMMAND ${CMAKE_BINARY_DIR}/tests/test_profile_input.x)

add_executable(test_profile_input_integration ${CMAKE_SOURCE_DIR}/KIM/tests/test_profile_input_integration.f90)
set_target_properties(test_profile_input_integration PROPERTIES
OUTPUT_NAME test_profile_input_integration.x
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests/")
target_link_libraries(test_profile_input_integration KIM_lib "${KiLCA_lib_path}" lapack cerf ddeabm slatec)
target_link_libraries(test_profile_input_integration KIM_lib kilca_lib lapack cerf ddeabm slatec)
add_test(NAME test_profile_input_integration
COMMAND ${CMAKE_BINARY_DIR}/tests/test_profile_input_integration.x)

add_executable(test_kim_diagnostics ${CMAKE_SOURCE_DIR}/KIM/tests/test_kim_diagnostics.f90)
set_target_properties(test_kim_diagnostics PROPERTIES
OUTPUT_NAME test_kim_diagnostics.x
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests/")
target_link_libraries(test_kim_diagnostics KIM_lib "${KiLCA_lib_path}" lapack cerf ddeabm slatec)
target_link_libraries(test_kim_diagnostics KIM_lib kilca_lib lapack cerf ddeabm slatec)
add_test(NAME test_kim_diagnostics
COMMAND ${CMAKE_BINARY_DIR}/tests/test_kim_diagnostics.x)

add_executable(test_ampere_matrices ${CMAKE_SOURCE_DIR}/KIM/tests/test_ampere_matrices.f90)
set_target_properties(test_ampere_matrices PROPERTIES
OUTPUT_NAME test_ampere_matrices.x
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests/")
target_link_libraries(test_ampere_matrices KIM_lib "${KiLCA_lib_path}" lapack cerf ddeabm slatec)
target_link_libraries(test_ampere_matrices KIM_lib kilca_lib lapack cerf ddeabm slatec)
add_test(NAME test_ampere_matrices
COMMAND ${CMAKE_BINARY_DIR}/tests/test_ampere_matrices.x)

Expand All @@ -69,23 +70,23 @@ add_executable(test_plag_coeff ${CMAKE_SOURCE_DIR}/KIM/tests/test_plag_coeff.f90
set_target_properties(test_plag_coeff PROPERTIES
OUTPUT_NAME test_plag_coeff.x
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests/")
target_link_libraries(test_plag_coeff KIM_lib "${KiLCA_lib_path}" lapack cerf ddeabm slatec)
target_link_libraries(test_plag_coeff KIM_lib kilca_lib lapack cerf ddeabm slatec)
add_test(NAME test_plag_coeff
COMMAND ${CMAKE_BINARY_DIR}/tests/test_plag_coeff.x)

add_executable(test_findIndex ${CMAKE_SOURCE_DIR}/KIM/tests/test_findIndex.f90)
set_target_properties(test_findIndex PROPERTIES
OUTPUT_NAME test_findIndex.x
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests/")
target_link_libraries(test_findIndex KIM_lib "${KiLCA_lib_path}" lapack cerf ddeabm slatec)
target_link_libraries(test_findIndex KIM_lib kilca_lib lapack cerf ddeabm slatec)
add_test(NAME test_findIndex
COMMAND ${CMAKE_BINARY_DIR}/tests/test_findIndex.x)

add_executable(test_grid_equidistant ${CMAKE_SOURCE_DIR}/KIM/tests/test_grid_equidistant.f90)
set_target_properties(test_grid_equidistant PROPERTIES
OUTPUT_NAME test_grid_equidistant.x
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests/")
target_link_libraries(test_grid_equidistant KIM_lib "${KiLCA_lib_path}" lapack cerf ddeabm slatec)
target_link_libraries(test_grid_equidistant KIM_lib kilca_lib lapack cerf ddeabm slatec)
add_test(NAME test_grid_equidistant
COMMAND ${CMAKE_BINARY_DIR}/tests/test_grid_equidistant.x)

Expand All @@ -94,7 +95,7 @@ add_executable(test_kim_solver ${CMAKE_SOURCE_DIR}/KIM/tests/test_kim_solver.f90
set_target_properties(test_kim_solver PROPERTIES
OUTPUT_NAME test_kim_solver.x
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests/")
target_link_libraries(test_kim_solver KIM_lib "${KiLCA_lib_path}" lapack cerf ddeabm slatec)
target_link_libraries(test_kim_solver KIM_lib kilca_lib lapack cerf ddeabm slatec)
add_test(NAME test_kim_solver
COMMAND ${CMAKE_BINARY_DIR}/tests/test_kim_solver.x)

Expand All @@ -103,7 +104,7 @@ add_executable(test_kim_solver_em ${CMAKE_SOURCE_DIR}/KIM/tests/test_kim_solver_
set_target_properties(test_kim_solver_em PROPERTIES
OUTPUT_NAME test_kim_solver_em.x
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests/")
target_link_libraries(test_kim_solver_em KIM_lib "${KiLCA_lib_path}" lapack cerf ddeabm slatec)
target_link_libraries(test_kim_solver_em KIM_lib kilca_lib lapack cerf ddeabm slatec)
configure_file(${CMAKE_SOURCE_DIR}/KIM/tests/test_data/KIM_config_em_small.nml
${CMAKE_BINARY_DIR}/tests/KIM_config_em_small.nml COPYONLY)
add_test(NAME test_kim_solver_em
Expand Down
11 changes: 6 additions & 5 deletions KiLCA/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ set (kilca_eigparam_main progs/main_eig_param.cpp)

# include paths:
set (libs_root_path ${CMAKE_BINARY_DIR}/external-install)
set (gsl_include_path ${libs_root_path}/gsl/include)

set(EXTERNAL_LIBS slatec lapack blas SUNDIALS::cvode SUNDIALS::nvecserial fortnum gsl gslcblas)
set(EXTERNAL_LIBS slatec lapack blas SUNDIALS::cvode SUNDIALS::nvecserial fortnum)

# configure a header file to pass some of the CMake settings to the source code
configure_file(
Expand All @@ -121,7 +120,6 @@ configure_file(
# Make generated header available
include_directories("${CMAKE_CURRENT_BINARY_DIR}")

include_directories ("${gsl_include_path}")
# fortnum C ABI header (fortnum.h); the Fortran fortnum target is linked above.
include_directories ("${fortnum_SOURCE_DIR}/include")
include_directories ("${PROJECT_BINARY_DIR}")
Expand Down Expand Up @@ -251,7 +249,11 @@ set_target_properties(kilca_lib PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/install/lib/
Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/OBJS/kilca/)
add_dependencies(kilca_lib ${EXTERNAL_LIBS})
target_link_libraries(kilca_lib PUBLIC ${EXTERNAL_LIBS})
# libneo objects pulled into the KiLCA link closure use OMP critical sections
# (GOMP_critical_*). Carry the OpenMP runtime on kilca_lib's PUBLIC interface so
# every consumer (KIM_exe, ql-balance_lib, and all KIM tests) inherits it and no
# downstream target has to re-declare OpenMP to link.
target_link_libraries(kilca_lib PUBLIC ${EXTERNAL_LIBS} OpenMP::OpenMP_Fortran)

# Add include directories on `kilca_lib` target for all source and module paths
target_include_directories(kilca_lib PUBLIC
Expand Down Expand Up @@ -284,7 +286,6 @@ target_include_directories(kilca_lib PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/spline
# External dependencies
${sundials_include_path}
${gsl_include_path}
${fortnum_SOURCE_DIR}/include
)

Expand Down
2 changes: 1 addition & 1 deletion KiLCA/interface/make_it
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ kilca_64bit="KiLCA_Lib_V_2.4_MDNO_FPGEN_USUAL_Debug_64bit"
#kilca_64bit="KiLCA_Lib_V_2.4_MDYES_FPGEN_POLYNOMIAL_Debug_64bit"
#kilca_64bit="libkilca_64bit"

gfortran ql-balance_mod.f90 wave_code_data_64bit.f90 bessel.f90 amn_of_r.f90 test_interface.f90 -L$kilca_lib_path -l$kilca_64bit -L$cvode_lib_path -lsundials_cvode -lsundials_nvecserial -L$slatec_lib_path -lslatec -lgsl -lgslcblas -lblas -llapack -lm -lc -lgfortran -lstdc++
gfortran ql-balance_mod.f90 wave_code_data_64bit.f90 bessel.f90 amn_of_r.f90 test_interface.f90 -L$kilca_lib_path -l$kilca_64bit -L$cvode_lib_path -lsundials_cvode -lsundials_nvecserial -L$slatec_lib_path -lslatec -lfortnum -lblas -llapack -lm -lc -lgfortran -lstdc++
2 changes: 1 addition & 1 deletion KiLCA/math/fourier/mk_fourier
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ cvode_lib_path = /usr/local/lib
libs = -L$(LINKER_PATH) \
-L$(math_lib_path) -lslatec_gf_430 -llapack_gf_430 -lblas_gf_430 \
-L$(cvode_lib_path) -lsundials_cvode -lsundials_nvecserial \
-lgsl -lgslcblas \
-lfortnum \
-lgfortran \
-lstdc++

Expand Down
4 changes: 2 additions & 2 deletions KiLCA/math/hyper/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ LINKER_PATH = /usr/local/gcc$(COMPILER_PREFIX)/lib
math_lib_path = /usr/local/lib/math_lib
cvode_lib_path = /usr/local/lib

libs = -lgsl -lstdc++
libs = -lfortnum -lstdc++


# libs = -L$(LINKER_PATH) \
# -L$(math_lib_path) -lslatec_gf_430 -llapack_gf_430 -lblas_gf_430 \
# -L$(cvode_lib_path) -lsundials_cvode -lsundials_nvecserial \
# -lgsl -lgslcblas \
# -lfortnum \
# -lgfortran \
# -lstdc++

Expand Down
2 changes: 0 additions & 2 deletions QL-Balance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ target_link_libraries(ql-balance_lib PUBLIC
SUNDIALS::nvecserial
blas
fortnum
gsl
gslcblas
hdf5::hdf5
hdf5::hdf5_fortran
hdf5::hdf5_hl
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The framework consists of three main codes:

### Auto-Fetched Libraries
The following are automatically downloaded and built if not found on the system:
- **GSL** - GNU Scientific Library
- **fortnum** - Numerical core (special functions, quadrature, ODE, root finding)
- **SuiteSparse** - Sparse matrix operations (UMFPACK)
- **SUNDIALS** - Numerical differential equation solvers
- **NetCDF** - Network Common Data Form (with Fortran bindings)
Expand Down Expand Up @@ -60,7 +60,7 @@ make QL-Balance
make clean
```

**Note:** External dependencies (LAPACK, SuiteSparse, GSL, SUNDIALS) are automatically downloaded and built during the first compilation if not found on the system.
**Note:** External dependencies (LAPACK, SuiteSparse, fortnum, SUNDIALS) are automatically downloaded and built during the first compilation if not found on the system.

To pin libneo to a specific branch, tag, or commit, pass `-DLIBNEO_REF=<ref>` to cmake or `LIBNEO_REF=<ref>` to make. To use a local checkout instead of fetching, pass `-DLIBNEO_PATH=<dir>` / `LIBNEO_PATH=<dir>`.

Expand Down
1 change: 0 additions & 1 deletion cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

# Core dependencies
include(FetchGSL)
include(FetchLapack)
include(FetchNetcdf)
include(FetchSuiteSparse)
Expand Down
42 changes: 0 additions & 42 deletions cmake/FetchGSL.cmake

This file was deleted.

3 changes: 1 addition & 2 deletions python/susc_functions/f2py_Ifuncs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ f2py -c src/getIfunc.f90 src/W2_arr.f90 $curr_loc/../../KiLCA/flre/conductivity/
-L$libs_path/sundials/build/src/nvector/serial/ -lsundials_nvecserial \
-L$libs_path/slatec/ -lslatec \
-L$libs_path/bessel/lib/ -lbessel \
-lgsl \
-lgslcblas \
-L$libs_path -lfortnum \
-lm \
-lc \
--verbose
1 change: 0 additions & 1 deletion utility_scripts/setup_arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ sudo pacman -Sy \
gcc \
gcc-fortran \
git \
gsl \
make \
netcdf \
netcdf-cxx \
Expand Down
2 changes: 1 addition & 1 deletion utility_scripts/setup_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

sudo apt update && apt install -y wget git cmake make gcc g++ gfortran \
libnetcdf-dev libnetcdff-dev openmpi-bin libopenmpi-dev libfftw3-dev \
python3 python3-pip python3-numpy python3-scipy ninja-build libgsl-dev \
python3 python3-pip python3-numpy python3-scipy ninja-build \
libopenblas-dev
Loading