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

[WIP] calc_temp_cloudy_g refactoring #207

Draft
wants to merge 60 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
f5870d4
Moved to CMake build (WIP)
ChristopherBignamini Mar 22, 2024
9a4e8fe
Cleanup
ChristopherBignamini Mar 30, 2024
17ba799
Missing include added
ChristopherBignamini Mar 30, 2024
c5ddafe
Test setup cmake file added
ChristopherBignamini Mar 30, 2024
dc1ddb6
C wrappers folder and interpolator wrappers created
ChristopherBignamini Mar 30, 2024
75e62cc
Intepolation unit test created (input/reference value tbd)
ChristopherBignamini Mar 30, 2024
e34fbfa
Chemistry local solve functional test added
ChristopherBignamini Apr 16, 2024
90b8288
Auto-generated files temporarily added to src/clib/generated folder
ChristopherBignamini Apr 17, 2024
4bdbe2b
Merge remote-tracking branch 'upstream/main' into main
ChristopherBignamini Apr 17, 2024
ac26deb
Missing source file added
ChristopherBignamini Apr 17, 2024
3579ea8
Test input update
ChristopherBignamini Apr 22, 2024
f09709e
Cleanup
ChristopherBignamini Apr 22, 2024
eef4d5d
calc_tdust_1d subroutine wrappers creation
ChristopherBignamini Apr 29, 2024
6f8805e
calc_tdust_1d wrappers build added
ChristopherBignamini Apr 29, 2024
dae16db
Refactored calc_tdust_1d unit test creation
ChristopherBignamini Apr 29, 2024
3c21d02
Refactored calc_tdust_1d unit test added
ChristopherBignamini Apr 29, 2024
18ef45a
Code refactoring (wip)
ChristopherBignamini Apr 29, 2024
d0efebf
calc_tdust_1d_g functional test added and cleanup
ChristopherBignamini Apr 29, 2024
3c12f84
calc_tdust_1d_g wrapper created
ChristopherBignamini Apr 29, 2024
28c839f
calc_tdust_1d_g test created
ChristopherBignamini Apr 29, 2024
2dd0ea8
Local solve chemistry functional test moved
ChristopherBignamini Apr 29, 2024
915586e
Local solve chemistry functional test moved
ChristopherBignamini Apr 29, 2024
b3e054e
cool1d_cloudy_g wrapper created
ChristopherBignamini May 3, 2024
c7c7d32
cool1d_cloudy_g test added and existing testname fix
ChristopherBignamini May 3, 2024
98ed8f1
[WIP] cool1d_cloudy_g test created
ChristopherBignamini May 3, 2024
03a2603
[WIP] refactoring subroutines created
ChristopherBignamini May 7, 2024
d33086d
Missing parameters in subroutine signature added
ChristopherBignamini May 8, 2024
d29d118
Check added in functional test
ChristopherBignamini May 8, 2024
5db3419
Interpolation subroutines renaming and signature cleanup
ChristopherBignamini May 17, 2024
9b15418
[WIP] unit test creation
ChristopherBignamini May 17, 2024
5d72b1f
Unit test build added
ChristopherBignamini May 17, 2024
90f0153
Interpolation subroutine wrappers created
ChristopherBignamini May 17, 2024
3e87b41
Function signature cleanup
ChristopherBignamini May 21, 2024
4d90e0f
Unit test creation for rank 2 case and code cleanup
ChristopherBignamini May 21, 2024
96e68ff
Rank 2 unit test added and name bug fix
ChristopherBignamini May 21, 2024
81808b2
Wrapper created for rank 3 interpolation
ChristopherBignamini May 22, 2024
1743d78
Rank 3 interpolation subroutine interface cleanup
ChristopherBignamini May 22, 2024
6bbf92d
Rank 3 interpolation subroutine signature update
ChristopherBignamini May 22, 2024
21393cd
Unit test creation for rank 3 interpolation
ChristopherBignamini May 22, 2024
9f04d57
Unit test creation for rank 3 interpolation
ChristopherBignamini May 22, 2024
81f82b6
Redshift index calculation test completed
ChristopherBignamini May 24, 2024
aaec597
Redshift index calculation subroutine wrapper added
ChristopherBignamini May 27, 2024
90ece49
Subroutine created for parammeter slope calculation to avoid code dup…
ChristopherBignamini May 28, 2024
7dcfe43
Code refactoring by means of parameter slope calculation subroutine u…
ChristopherBignamini May 28, 2024
cc816b3
cool1d_cloudy_old_tables_g functional tests created
ChristopherBignamini Jun 25, 2024
e06621f
Input GridDim dimensions fix
ChristopherBignamini Jun 25, 2024
5651d1e
Parameter slope calculation subroutine interface updated and unit tes…
ChristopherBignamini Jun 27, 2024
9016342
compute_redshift_dimension test/wrapper moved to calc_temp_utilities_…
ChristopherBignamini Jul 19, 2024
5137e9b
compute_redshift_dimension
ChristopherBignamini Jul 19, 2024
5b4c8b5
Example GTest created
ChristopherBignamini Sep 16, 2024
54491c3
Redundant line removed
ChristopherBignamini Sep 26, 2024
103d541
CI config update for GTests execution
ChristopherBignamini Sep 27, 2024
3e7ae54
Update to GTest zip downloading instead of cloning
ChristopherBignamini Sep 27, 2024
99e438b
Automated test discovery and LINUX option issue fixed
ChristopherBignamini Sep 27, 2024
c084a64
Test build flag naming updated
ChristopherBignamini Sep 27, 2024
5a06f1b
Cmake files cleanup and comments added
ChristopherBignamini Sep 30, 2024
f1e674a
Merge remote-tracking branch 'origin/gtest_integration' into main
ChristopherBignamini Oct 1, 2024
b75c050
Source folder reorganization
ChristopherBignamini Oct 1, 2024
3820fdb
Folder deleted
ChristopherBignamini Oct 1, 2024
34c8382
Merge branch 'main' into calc_temp_cloudy_g_refactoring
ChristopherBignamini Oct 8, 2024
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
11 changes: 11 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,17 @@ jobs:
build_kind: 'cmake'
generate: 'false'

- run:
name: "Execute the C++ tests"
command: |
# compile the tests (it would probably would be better to do this when
# compiling the rest of Grackle)
cmake -DGRACKLE_BUILD_TESTS=ON -Bbuild
cmake --build build
# execute the tests
cd build
ctest

# TODO: once we merge in GH-#208, we need to issue a new gold standard, and then we should
# issue a followup PR where we uncomment the remainder of this test
test-standalone-pygrackle:
Expand Down
21 changes: 21 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ endif()
cmake_minimum_required(VERSION 3.16)
cmake_policy(SET CMP0077 NEW)
cmake_policy(SET CMP0082 NEW)

if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
cmake_policy(SET CMP0135 NEW) # makes automatic dependency downloads more
# robust (& addresses noisy warnings)
endif()

project(Grackle VERSION ${_GRACKLE_VERSION_NO_DEVTAG} LANGUAGES C CXX Fortran)

# Specify that `./cmake` contains cmake modules defining useful functionality
Expand Down Expand Up @@ -184,6 +190,21 @@ endif()
# -----
# (this is where we will add targets for integration tests)

# Add BUILD_TESTS option available
option(GRACKLE_BUILD_TESTS "build Grackle tests using GoogleTest" OFF)

# if desired, setup Grackle's tests that use GoogleTest (this has no impact on
# the tests run via pytest, those are handled outside of cmake)
if(GRACKLE_BUILD_TESTS)
# setup GoogleTest framework (search for an installed copy on the machine
# OR download it & add its compilation to the rest of the build procedure)
include(setup_GTest)
# load CMake's built-in module that defines functions to registering unit
# tests implemented with GoogleTest into CMake's test-runner, CTest
include(GoogleTest)
enable_testing() # enable the test-runner, CTest
add_subdirectory(tests) # declare the recipes for each test
endif()

# Packaging
# ---------
Expand Down
35 changes: 35 additions & 0 deletions cmake/setup_GTest.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This file includes logic for setting up GoogleTest
find_package(GTest)

if (NOT GTest_FOUND)
message(STATUS
"Preparing to download GTest from GitHub & configure its build. Don't "
"worry about any mentions of Python in the following text -- that is "
"only used internally by the Google test build"
)

# NOTE: it is idiomatic to use FetchContent with a git hash rather than the
# name of a tag or branch (since the latter 2 can freely change). If we use
# the name of a tag/branch, then CMake will query GitHub on every
# subsequent build to check whether the tag/branch is still the same

include(FetchContent)
FetchContent_Declare(
googletest # the url contains the hash for v1.13.0
URL https://github.com/google/googletest/archive/b796f7d44681514f58a683a3a71ff17c94edb0c1.zip
)

# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)

elseif("${CMAKE_VERSION}" VERSION_LESS "3.20")
# CMake's built-in `FindGTest` module imported targets have different names
# in earlier CMake versions
add_library(GTest::gtest ALIAS GTest::GTest)
add_library(GTest::gtest_main ALIAS GTest::Main)
endif()

if (NOT TARGET GTest::gtest_main)
message("Target GTest:: stuff MISSING")
endif()
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_subdirectory(clib)
add_subdirectory(example)
11 changes: 0 additions & 11 deletions src/Makefile

This file was deleted.

8 changes: 8 additions & 0 deletions src/clib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ add_library(Grackle_Grackle
calc_tdust_3d_g.F
calc_temp1d_cloudy_g.F
calc_temp_cloudy_g.F
calc_temp_utilities_g.F
cool1d_cloudy_g.F
cool1d_cloudy_old_tables_g.F
cool1d_multi_g.F
Expand Down Expand Up @@ -141,6 +142,13 @@ add_library(Grackle_Grackle
phys_constants.h
utils.h

# C wrappers
c_wrappers/wrap_calc_tdust_1d_g.c
c_wrappers/wrap_calc_temp_utilities_g.c
c_wrappers/wrap_cool1d_cloudy_g.c
c_wrappers/wrap_cool1d_cloudy_old_tables_g.c
c_wrappers/wrap_interpolators_g.c

# Fortran public headers
../include/grackle.def
../include/grackle_fortran_interface.def
Expand Down
44 changes: 0 additions & 44 deletions src/clib/Make.config.settings

This file was deleted.

112 changes: 0 additions & 112 deletions src/clib/Make.mach.darwin

This file was deleted.

85 changes: 0 additions & 85 deletions src/clib/Make.mach.linux-gnu

This file was deleted.

Loading