Skip to content

Commit

Permalink
Merge pull request #455 from AgnieszkaMakulska/bulk_ice
Browse files Browse the repository at this point in the history
Ice in blk_1m
  • Loading branch information
pdziekan authored Dec 2, 2024
2 parents 046d52f + ccc1216 commit 7174907
Show file tree
Hide file tree
Showing 12 changed files with 1,324 additions and 279 deletions.
130 changes: 65 additions & 65 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -260,20 +260,20 @@ endif()

############################################################################################
# Thrust, location of Thrust can be hinted by setting THRUST_INCLUDE_DIR
find_package(Thrust)

if (NOT THRUST_INCLUDE_DIR)
message(FATAL_ERROR "Thrust library not found.
* To install Thrust, please try:
* Debian/Ubuntu: sudo apt-get install libthrust-dev
* Fedora: TODO
* Homebrew: TODO
")
endif()
find_package(Thrust REQUIRED)

#if (NOT THRUST_INCLUDE_DIR)
# message(FATAL_ERROR "Thrust library not found.
#
#* To install Thrust, please try:
#* Debian/Ubuntu: sudo apt-get install libthrust-dev
#* Fedora: TODO
#* Homebrew: TODO
# ")
#endif()

# include thrust found here instead of the one shipped with cuda
target_include_directories(cloudphxx_lgrngn PRIVATE ${THRUST_INCLUDE_DIR})
#target_include_directories(cloudphxx_lgrngn PRIVATE ${THRUST_INCLUDE_DIR})

############################################################################################
# Boost libraries
Expand All @@ -296,59 +296,59 @@ endif()

############################################################################################
# BOOST ODEINT VERSION TEST
message(STATUS "Testing if Boost ODEINT version >= 1.58")
set(pfx "boost odeint check")
execute_process(COMMAND "mktemp" "-d" "/tmp/tmp.XXX" RESULT_VARIABLE status OUTPUT_VARIABLE tmpdir)
if (NOT status EQUAL 0)
message(FATAL_ERROR "${pfx}: mkdtemp failed")
endif()
file(WRITE "${tmpdir}/test.cpp" "
#define THRUST_DEVICE_SYSTEM THRUST_DEVICE_SYSTEM_CPP
#include <thrust/system/cpp/vector.h>
#include <boost/numeric/odeint.hpp>
#include <boost/numeric/odeint/external/thrust/thrust.hpp>
struct rhs
{
void operator()(
const thrust::cpp::vector<float> &psi,
thrust::cpp::vector<float> &dot_psi,
const float /* t */
)
{
assert(psi.size() == dot_psi.size());
}
};
int main()
{
boost::numeric::odeint::euler<
thrust::cpp::vector<float>, // state_type
float, // value_type
thrust::cpp::vector<float>, // deriv_type
float, // time_type
boost::numeric::odeint::thrust_algebra,
boost::numeric::odeint::thrust_operations
> chem_stepper;
thrust::cpp::vector<float> v(2);
chem_stepper.do_step(rhs(), v, 0, 1);
}
")
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-std=c++14" "test.cpp" "-I${Boost_INCLUDE_DIR}" "-I${THRUST_INCLUDE_DIR}" WORKING_DIRECTORY ${tmpdir} RESULT_VARIABLE status ERROR_VARIABLE msg)
if (NOT status EQUAL 0)
message(FATAL_ERROR "${pfx}: c++ compiler failed\n ${msg}")
endif()
execute_process(COMMAND "./a.out" WORKING_DIRECTORY ${tmpdir} RESULT_VARIABLE status OUTPUT_VARIABLE msg)
if (NOT status EQUAL 0)
message(FATAL_ERROR "${pfx}: test program failed, install Boost odeint version >= 1.58")
endif()
unset(pfx)
unset(tmpdir)
unset(msg)
unset(status)
#message(STATUS "Testing if Boost ODEINT version >= 1.58")
#set(pfx "boost odeint check")
#execute_process(COMMAND "mktemp" "-d" "/tmp/tmp.XXX" RESULT_VARIABLE status OUTPUT_VARIABLE tmpdir)
#if (NOT status EQUAL 0)
# message(FATAL_ERROR "${pfx}: mkdtemp failed")
#endif()
#file(WRITE "${tmpdir}/test.cpp" "
# #define THRUST_DEVICE_SYSTEM THRUST_DEVICE_SYSTEM_CPP
#
# #include <thrust/system/cpp/vector.h>
#
# #include <boost/numeric/odeint.hpp>
# #include <boost/numeric/odeint/external/thrust/thrust.hpp>
#
# struct rhs
# {
# void operator()(
# const thrust::cpp::vector<float> &psi,
# thrust::cpp::vector<float> &dot_psi,
# const float /* t */
# )
# {
# assert(psi.size() == dot_psi.size());
# }
# };
#
# int main()
# {
# boost::numeric::odeint::euler<
# thrust::cpp::vector<float>, // state_type
# float, // value_type
# thrust::cpp::vector<float>, // deriv_type
# float, // time_type
# boost::numeric::odeint::thrust_algebra,
# boost::numeric::odeint::thrust_operations
# > chem_stepper;
#
# thrust::cpp::vector<float> v(2);
# chem_stepper.do_step(rhs(), v, 0, 1);
# }
#")
#execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-std=c++14" "test.cpp" "-I${Boost_INCLUDE_DIR}" "-I${THRUST_INCLUDE_DIR}" WORKING_DIRECTORY ${tmpdir} RESULT_VARIABLE status ERROR_VARIABLE msg)
#if (NOT status EQUAL 0)
# message(FATAL_ERROR "${pfx}: c++ compiler failed\n ${msg}")
#endif()
#execute_process(COMMAND "./a.out" WORKING_DIRECTORY ${tmpdir} RESULT_VARIABLE status OUTPUT_VARIABLE msg)
#if (NOT status EQUAL 0)
# message(FATAL_ERROR "${pfx}: test program failed, install Boost odeint version >= 1.58")
#endif()
#unset(pfx)
#unset(tmpdir)
#unset(msg)
#unset(status)

# generate a header file with git revision id
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
Expand Down
Loading

0 comments on commit 7174907

Please sign in to comment.