Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to work with new intel compiler #29

Merged
merged 1 commit into from
Jan 23, 2025
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
61 changes: 34 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ else()
endif()

# New unit tests (UNDER DEVELOPMENT)
add_test(test_rxn_arrhenius_mech ${CMAKE_BINARY_DIR}/test_run/unit_tests/input_files/run_rxn_arrhenius.sh ${MPI_TEST_FLAG})
if (NOT ${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel")
add_test(test_rxn_arrhenius_mech ${CMAKE_BINARY_DIR}/test_run/unit_tests/input_files/run_rxn_arrhenius.sh ${MPI_TEST_FLAG})
endif()

# Old-style unit tests
add_test(test_rxn_aqueous_equilibrium ${CMAKE_BINARY_DIR}/test_run/unit_rxn_data/test_aqueous_equilibrium.sh ${MPI_TEST_FLAG})
Expand All @@ -206,8 +208,10 @@ add_test(test_sub_model_UNIFAC ${CMAKE_BINARY_DIR}/test_run/unit_sub_model_data/
add_test(test_sub_model_ZSR_aerosol_water ${CMAKE_BINARY_DIR}/test_run/unit_sub_model_data/test_ZSR_aerosol_water.sh ${MPI_TEST_FLAG})
add_test(test_chem_mech_solver ${CMAKE_BINARY_DIR}/test_run/chemistry/test_chemistry_1.sh ${MPI_TEST_FLAG})
add_test(test_chemistry_cb05cl_ae5 ${CMAKE_BINARY_DIR}/test_run/chemistry/cb05cl_ae5/test_chemistry_cb05cl_ae5.sh ${MPI_TEST_FLAG})
add_test(test_MONARCH_1 ${CMAKE_BINARY_DIR}/test_run/monarch/test_monarch_1.sh ${MPI_TEST_FLAG})
add_test(test_MONARCH_2 ${CMAKE_BINARY_DIR}/test_run/monarch/test_monarch_2.sh ${MPI_TEST_FLAG})
if(NOT ${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel")
add_test(test_MONARCH_1 ${CMAKE_BINARY_DIR}/test_run/monarch/test_monarch_1.sh ${MPI_TEST_FLAG})
add_test(test_MONARCH_2 ${CMAKE_BINARY_DIR}/test_run/monarch/test_monarch_2.sh ${MPI_TEST_FLAG})
endif()
add_test(boot_camp_part_1 ${CMAKE_BINARY_DIR}/boot_camp_run/part_2_code/run_part_1.sh ${MPI_TEST_FLAG})
add_test(boot_camp_part_2 ${CMAKE_BINARY_DIR}/boot_camp_run/part_2_code/run_part_2.sh ${MPI_TEST_FLAG})
add_test(boot_camp_part_3 ${CMAKE_BINARY_DIR}/boot_camp_run/part_3_code/run_part_3.sh ${MPI_TEST_FLAG})
Expand All @@ -222,7 +226,7 @@ set(STD_C_FLAGS "-std=c99 -Werror=format")
set(STD_CUDA_FLAGS "-dc -arch=compute_70 -code=sm_70")

if(${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel")
set(STD_F_FLAGS "-extend_source -warn truncated_source")
set(STD_F_FLAGS "-extend-source -warn truncated_source")
elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
set(STD_F_FLAGS "-ffree-line-length-none")
endif()
Expand Down Expand Up @@ -443,7 +447,7 @@ set(CB5_KPP_SOLVER
)

if(${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel")
set(CB5_EBI_FLAGS "-fixed -extend_source -warn truncated_source")
set(CB5_EBI_FLAGS "-fixed -extend-source -warn truncated_source")
elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
set(CB5_EBI_FLAGS "-ffixed-form -ffixed-line-length-none")
endif()
Expand All @@ -463,10 +467,11 @@ target_link_libraries(test_chemistry_cb05cl_ae5_big camplib)
######################################################################
# MONARCH interface

add_executable(mock_monarch test/monarch/mock_monarch.F90
test/monarch/camp_monarch_interface.F90)

target_link_libraries(mock_monarch camplib)
if(NOT ${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel")
add_executable(mock_monarch test/monarch/mock_monarch.F90
test/monarch/camp_monarch_interface.F90)
target_link_libraries(mock_monarch camplib)
endif()

######################################################################
# test_chemistry_cb05cl_ae5
Expand Down Expand Up @@ -549,25 +554,27 @@ target_link_libraries(test_sub_model_ZSR_aerosol_water camplib)
######################################################################
# New unit tests (UNDER DEVELOPMENT)

set(UNIT_TEST_SRC
test/unit_tests/unit_test_data.F90
test/unit_tests/unit_test_driver.F90)

set(UNIT_TEST_RXN_ARRHENIUS_SRC
test/unit_tests/rxns/unit_test_rxn_arrhenius.F90 ${UNIT_TEST_SRC})
if(${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel")
set_source_files_properties(${UNIT_TEST_RXN_ARRHENIUS_SRC} PROPERTIES COMPILE_DEFINITIONS
"UNIT_TEST_MODULE_=camp_unit_test_rxn_arrhenius \
;UNIT_TEST_TYPE_='unit_test_rxn_arrhenius_t()'")
elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
set_source_files_properties(${UNIT_TEST_RXN_ARRHENIUS_SRC} PROPERTIES COMPILE_DEFINITIONS
"UNIT_TEST_MODULE_=camp_unit_test_rxn_arrhenius \
;UNIT_TEST_TYPE_=unit_test_rxn_arrhenius_t()")
if(NOT ${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel")
set(UNIT_TEST_SRC
test/unit_tests/unit_test_data.F90
test/unit_tests/unit_test_driver.F90)

set(UNIT_TEST_RXN_ARRHENIUS_SRC
test/unit_tests/rxns/unit_test_rxn_arrhenius.F90 ${UNIT_TEST_SRC})
if(${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel")
set_source_files_properties(${UNIT_TEST_RXN_ARRHENIUS_SRC} PROPERTIES COMPILE_DEFINITIONS
"UNIT_TEST_MODULE_=camp_unit_test_rxn_arrhenius \
;UNIT_TEST_TYPE_='unit_test_rxn_arrhenius_t()'")
elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
set_source_files_properties(${UNIT_TEST_RXN_ARRHENIUS_SRC} PROPERTIES COMPILE_DEFINITIONS
"UNIT_TEST_MODULE_=camp_unit_test_rxn_arrhenius \
;UNIT_TEST_TYPE_=unit_test_rxn_arrhenius_t()")
endif()
set_source_files_properties(${UNIT_TEST_RXN_ARRHENIUS_SRC} PROPERTIES COMPILE_FLAGS
${STD_F_FLAGS})
add_executable(unit_test_rxn_arrhenius ${UNIT_TEST_RXN_ARRHENIUS_SRC})
target_link_libraries(unit_test_rxn_arrhenius camplib)
endif()
set_source_files_properties(${UNIT_TEST_RXN_ARRHENIUS_SRC} PROPERTIES COMPILE_FLAGS
${STD_F_FLAGS})
add_executable(unit_test_rxn_arrhenius ${UNIT_TEST_RXN_ARRHENIUS_SRC})
target_link_libraries(unit_test_rxn_arrhenius camplib)

######################################################################
# test_camp_core
Expand Down
78 changes: 78 additions & 0 deletions Dockerfile.intel
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
FROM intel/oneapi-hpckit:latest

RUN apt update \
&& apt install -y software-properties-common \
&& add-apt-repository universe \
&& apt update \
&& apt install -y \
build-essential \
make \
libhdf5-dev \
libnetcdf-dev \
libnetcdff-dev \
libmetis-dev \
liblapack-dev \
libopenblas-dev \
libgsl-dev \
cmake \
&& apt clean

# set compilers
ENV CC=icx
ENV CXX=icpx
ENV FC=ifx

# Build the SuiteSparse libraries for sparse matrix support
# (-k included because of problem with SuiteSparse security certificate - 1 Aug 2021)
RUN curl -kLO http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-5.1.0.tar.gz \
&& tar -zxvf SuiteSparse-5.1.0.tar.gz \
&& cd SuiteSparse \
&& make install INSTALL=/usr/local BLAS="-L/lib64 -lopenblas"

# Install json-fortran
RUN curl -LO https://github.com/jacobwilliams/json-fortran/archive/6.1.0.tar.gz \
&& tar -zxvf 6.1.0.tar.gz \
&& cd json-fortran-6.1.0 \
&& mkdir build \
&& cd build \
&& cmake -D SKIP_DOC_GEN:BOOL=TRUE .. \
&& make install

# copy CVODE source
COPY cvode-3.4-alpha.tar.gz /cvode-3.4-alpha.tar.gz

# Install a modified version of CVODE
RUN tar -zxvf /cvode-3.4-alpha.tar.gz \
&& cd cvode-3.4-alpha \
&& mkdir build \
&& cd build \
&& cmake -D CMAKE_BUILD_TYPE=release \
-D CMAKE_C_FLAGS_DEBUG="-g -pg" \
-D CMAKE_EXE_LINKER_FLAGS_DEBUG="-pg" \
-D CMAKE_MODULE_LINKER_FLAGS_DEBUG="-pg" \
-D CMAKE_SHARED_LINKER_FLAGS_DEBUG="-pg" \
-D KLU_ENABLE:BOOL=TRUE \
-D KLU_LIBRARY_DIR=/usr/local/lib \
-D KLU_INCLUDE_DIR=/usr/local/include \
.. \
&& make install

# copy CAMP source code and data
COPY . /camp

# Update environment variables
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/lib64:/usr/local/jsonfortran-gnu-6.1.0/lib"
ENV PATH="${PATH}:/usr/local/jsonfortran-gnu-6.1.0/lib"

# Build CAMP
RUN mkdir build \
&& cd build \
&& export JSON_FORTRAN_HOME="/usr/local/jsonfortran-intelllvm-6.1.0" \
&& cmake -D CMAKE_BUILD_TYPE=release \
-D CMAKE_C_FLAGS_DEBUG="-pg" \
-D CMAKE_Fortran_FLAGS_DEBUG="-pg" \
-D CMAKE_MODULE_LINKER_FLAGS="-pg" \
/camp \
&& make -j install

WORKDIR /build
2 changes: 1 addition & 1 deletion data/CAMP_v1_paper/binned/camp_monarch_interface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ end subroutine do_print
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!> Finalize the interface
elemental subroutine finalize(this)
subroutine finalize(this)

!> PartMC-camp <-> MONARCH interface
type(monarch_interface_t), intent(inout) :: this
Expand Down
2 changes: 1 addition & 1 deletion data/CAMP_v1_paper/modal/camp_monarch_interface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@ end subroutine do_print
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!> Finalize the interface
elemental subroutine finalize(this)
subroutine finalize(this)

!> PartMC-camp <-> MONARCH interface
type(monarch_interface_t), intent(inout) :: this
Expand Down
40 changes: 36 additions & 4 deletions src/aero_phase_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ module camp_aero_phase_data
!> Print the aerosol phase data
procedure :: print => do_print
!> Finalize the aerosol phase data
final :: finalize
final :: finalize, finalize_array

! Private functions
!> Ensure there is enough room in the species dataset to add a specified
Expand All @@ -151,7 +151,7 @@ module camp_aero_phase_data
!> Dereference the pointer
procedure :: dereference
!> Finalize the pointer
final :: ptr_finalize
final :: ptr_finalize, ptr_finalize_array
end type aero_phase_data_ptr

contains
Expand Down Expand Up @@ -584,7 +584,7 @@ end subroutine do_print
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!> Finalize the aerosol phase data
elemental subroutine finalize(this)
subroutine finalize(this)

!> Aerosol phase data
type(aero_phase_data_t), intent(inout) :: this
Expand All @@ -599,6 +599,22 @@ elemental subroutine finalize(this)

end subroutine finalize

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!> Finalize the aerosol phase data
subroutine finalize_array(this)

!> Aerosol phase data
type(aero_phase_data_t), intent(inout) :: this(:)

integer(kind=i_kind) :: i_phase

do i_phase = 1, size(this)
call finalize(this(i_phase))
end do

end subroutine finalize_array

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!> Ensure there is enough room in the species dataset to add a specified
Expand Down Expand Up @@ -685,7 +701,7 @@ end subroutine dereference
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!> Finalize a pointer to aerosol phase data
elemental subroutine ptr_finalize(this)
subroutine ptr_finalize(this)

!> Pointer to aerosol phase data
type(aero_phase_data_ptr), intent(inout) :: this
Expand All @@ -694,6 +710,22 @@ elemental subroutine ptr_finalize(this)

end subroutine ptr_finalize

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!> Finalize an array of pointers to aerosol phase data
subroutine ptr_finalize_array(this)

!> Array of pointers to aerosol phase data
type(aero_phase_data_ptr), intent(inout) :: this(:)

integer(kind=i_kind) :: i_ptr

do i_ptr = 1, size(this)
call ptr_finalize(this(i_ptr))
end do

end subroutine ptr_finalize_array

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

#undef NUM_STATE_VAR_
Expand Down
20 changes: 18 additions & 2 deletions src/aero_rep_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ module camp_aero_rep_data
!> Dereference the pointer
procedure :: dereference
!> Finalize the pointer
final :: ptr_finalize
final :: ptr_finalize, ptr_finalize_array
end type aero_rep_data_ptr

!> Update cookie
Expand Down Expand Up @@ -652,7 +652,7 @@ end subroutine dereference
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!> Finalize a pointer to an aerosol representation
elemental subroutine ptr_finalize(this)
subroutine ptr_finalize(this)

!> Pointer to an aerosol representation
type(aero_rep_data_ptr), intent(inout) :: this
Expand All @@ -661,6 +661,22 @@ elemental subroutine ptr_finalize(this)

end subroutine ptr_finalize

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!> Finalize an array of pointers to aerosol representations
subroutine ptr_finalize_array(this)

!> Array of pointers to aerosol representations
type(aero_rep_data_ptr), intent(inout) :: this(:)

integer(kind=i_kind) :: i

do i = 1, size(this)
call ptr_finalize(this(i))
end do

end subroutine ptr_finalize_array

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!> Get the update data aerosol representation type
Expand Down
Loading
Loading