Skip to content

Commit 8cf24fa

Browse files
committed
Merge branch 'master' of github.com:igfuw/libcloudphxx into kida-1d
2 parents f837f7e + eba54a0 commit 8cf24fa

25 files changed

+77
-47
lines changed

.travis.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ aliases:
6868
jobs:
6969
include:
7070
- <<: *precache_tests_mpi
71-
env: TEST_SUITE=MPI_tests MPI=mvapich2
71+
env: TEST_SUITE=tests MPI=mvapich2
7272
compiler: gcc
7373
# clang MPI_tests disabled due to issues with manually built boost python libstdc++ / libc++ issues
7474
# - <<: *precache_default
@@ -88,7 +88,7 @@ jobs:
8888
env: TEST_SUITE=cuda MPI=none
8989

9090
- compiler: clang
91-
env: TEST_SUITE=MPI_tests MPI=none
91+
env: TEST_SUITE=tests MPI=mvapich2
9292

9393
- compiler: clang
9494
env: TEST_SUITE=UWLCM_MT MPI=mvapich2
@@ -180,7 +180,7 @@ install:
180180
- if [[ $MPI == 'none' && ($TEST_SUITE != 'tests' || $TEST_SUITE != 'KidA') ]]; then sudo ln -s /usr/lib/x86_64-linux-gnu/libboost_python-py35.so /usr/lib/x86_64-linux-gnu/libboost_python3.so; fi # different naming conventions for boost python with python 3
181181

182182
# thrust
183-
- git clone --depth=1 git://github.com/thrust/thrust.git;
183+
- git clone --depth=1 git://github.com/thrust/thrust.git --branch 1.9.10-1;
184184
- sudo ln -s `pwd`/thrust/thrust /usr/local/include/thrust;
185185
- if [[ $TEST_SUITE == 'cuda' ]]; then sudo ln -s `pwd`/thrust/thrust /usr/local/cuda/include/thrust; fi
186186

@@ -202,6 +202,4 @@ script:
202202
- if [[ $TEST_SUITE == 'UWLCM_unit_smg' ]]; then . ./.travis_scripts/UWLCM.sh unit_smg; fi
203203
# KiD-A 1D
204204
- if [[ $TEST_SUITE == 'KidA' ]]; then . ./.travis_scripts/KidA.sh; fi
205-
# unit tests and drops.py with MPI (drop drops here?)
206-
- if [[ $TEST_SUITE == 'MPI_tests' ]]; then . ./.travis_scripts/tests.sh; fi
207205

.travis_scripts/deps_install/boost.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
1919
cat $HOME/user-config.jam
2020
if [[ $COMPILER == 'g++' ]]; then
2121
./bootstrap.sh --prefix=${DEPS_DIR}/boost/ --with-libraries=chrono,regex,serialization,mpi,atomic,thread,date_time,system,iostreams,timer,filesystem,program_options,python
22-
./b2 -d0 install
22+
travis_wait 30 ./b2 -d0 install
2323
fi
2424
if [[ $COMPILER == 'clang++' ]]; then
2525
#clang installation taken from https://gist.github.com/jimporter/10442880

include/libcloudph++/common/output.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ namespace libcloudphxx
1616
outS_VI = chem::S_VI,
1717
outH = chem::H,
1818
outliq_vol,
19-
outdry_vol
19+
outdry_vol,
20+
outprtcl_num
2021
};
2122

2223
const std::map<output_t, std::string> output_names
@@ -30,7 +31,8 @@ namespace libcloudphxx
3031
{outS_VI , "S_VI"},
3132
{outH , "H"},
3233
{outliq_vol, "liquid_volume"},
33-
{outdry_vol, "dry_volume"}
34+
{outdry_vol, "dry_volume"},
35+
{outprtcl_num, "particle_number"}
3436
};
3537
};
3638
};

models/kinematic_2D/tests/paper_GMD_2015/fig_a/CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ add_test(travis_2D_kin_cloud_dims_blk bash -c "
5959
add_test(travis_2D_kin_cloud_diff_blk_1m bash -c "
6060
for dir in travis_out_blk_1m; do
6161
echo 'comparing const.h5' &&
62-
h5diff --delta=2e-7 -v2 $dir/const.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/const.h5 &&
62+
h5diff --delta=3e-7 -v2 $dir/const.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/const.h5 &&
6363
echo 'comparing timestep0000000000.h5' &&
6464
h5diff --delta=2e-5 -v2 $dir/timestep0000000000.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/timestep0000000000.h5 /rv &&
6565
h5diff --delta=2e-5 -v2 $dir/timestep0000000000.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/timestep0000000000.h5 /rr &&
@@ -76,7 +76,7 @@ add_test(travis_2D_kin_cloud_diff_blk_1m bash -c "
7676
add_test(travis_2D_kin_cloud_diff_blk_2m bash -c "
7777
for dir in travis_out_blk_2m; do
7878
echo 'comparing const.h5'
79-
h5diff --delta=2e-7 -v2 $dir/const.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/const.h5 &&
79+
h5diff --delta=3e-7 -v2 $dir/const.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/const.h5 &&
8080
echo 'comparing timestep0000000000.h5' &&
8181
h5diff --relative=1e-9 -v2 $dir/timestep0000000000.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/timestep0000000000.h5 /rv &&
8282
h5diff --relative=1e-9 -v2 $dir/timestep0000000000.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/timestep0000000000.h5 /rr &&
@@ -106,14 +106,14 @@ add_test(travis_2D_kin_cloud_dims_lgrngn bash -c "
106106
add_test(travis_2D_kin_cloud_diff_lgrngn bash -c "
107107
for dir in travis_out_lgrngn; do
108108
echo 'comparing const.h5'
109-
h5diff --delta=1e-6 -v2 $dir/const.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/travis_const.h5 &&
109+
h5diff --delta=1e-6 -v2 $dir/const.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/travis_const.h5 &&
110110
echo 'comparing timestep0000000000.h5' &&
111-
h5diff --relative=1e-9 -v2 $dir/timestep0000000000.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/travis_timestep0000000000.h5 /th &&
112-
h5diff --relative=1e-9 -v2 $dir/timestep0000000000.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/travis_timestep0000000000.h5 /rv &&
113-
h5diff --relative=1e-9 -v2 $dir/timestep0000000000.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/travis_timestep0000000000.h5 /sd_conc &&
111+
h5diff --relative=1e-9 -v2 $dir/timestep0000000000.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/travis_timestep0000000000.h5 /th &&
112+
h5diff --relative=1e-9 -v2 $dir/timestep0000000000.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/travis_timestep0000000000.h5 /rv &&
113+
h5diff --relative=1e-9 -v2 $dir/timestep0000000000.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/travis_timestep0000000000.h5 /sd_conc &&
114114
echo 'comparing timestep0000000020.h5' &&
115-
h5diff --relative=0.001 -v2 $dir/timestep0000000020.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/travis_timestep0000000020.h5 /th &&
116-
h5diff --relative=0.002 -v2 $dir/timestep0000000020.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/travis_timestep0000000020.h5 /rv &&
117-
h5diff --delta=1 -v2 $dir/timestep0000000020.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/travis_timestep0000000020.h5 /sd_conc || exit 1;
115+
h5diff --relative=0.001 -v2 $dir/timestep0000000020.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/travis_timestep0000000020.h5 /th &&
116+
h5diff --relative=0.0021 -v2 $dir/timestep0000000020.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/travis_timestep0000000020.h5 /rv &&
117+
h5diff --delta=1 -v2 $dir/timestep0000000020.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/travis_timestep0000000020.h5 /sd_conc || exit 1;
118118
done
119119
")

src/detail/gpu_assert.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace libcloudphxx
1616
{
1717
namespace detail
1818
{
19-
void gpuAssert(cudaError_t code, const char *file, int line, bool abort=true)
19+
inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort=true)
2020
{
2121
if (code != cudaSuccess)
2222
{
@@ -26,10 +26,10 @@ namespace libcloudphxx
2626
}
2727

2828
// max(1, n)
29-
int m1(int n) { return n == 0 ? 1 : n; }
29+
inline int m1(int n) { return n == 0 ? 1 : n; }
3030

3131
// run a function on a specific gpu
32-
void set_device_and_run(int id, std::function<void()> fun)
32+
inline void set_device_and_run(int id, std::function<void()> fun)
3333
{
3434
gpuErrchk(cudaSetDevice(id));
3535
fun();

src/detail/urand.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@ namespace libcloudphxx
120120
)
121121
{
122122
int status = curandGenerateUniform(gen, thrust::raw_pointer_cast(v.data()), n);
123-
assert(status == CURAND_STATUS_SUCCESS /* && "curandGenerateUniform failed"*/);
123+
assert(status == CURAND_STATUS_SUCCESS /* && "curandGenerateUniform failed"*/);
124124
_unused(status);
125+
125126
}
126127

127128
void generate_n(

src/impl/particles_impl.ipp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ namespace libcloudphxx
354354

355355
// if using nvcc, put increase_sstp_coal flag in host memory, but with direct access from device code
356356
#if defined(__NVCC__)
357-
cudaMallocHost(&increase_sstp_coal, sizeof(bool));
357+
gpuErrchk(cudaMallocHost(&increase_sstp_coal, sizeof(bool)));
358358
#else
359359
increase_sstp_coal = new bool();
360360
#endif

src/impl/particles_impl_bcnd.ipp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ namespace libcloudphxx
6868
BOOST_GPU_ENABLED
6969
real_t operator()(real_t x)
7070
{
71-
return a + fmod((x-a) + (b-a), b-a); // this should call CUDA's fmod!
71+
return a + fmod((x-a) + 10 * (b-a), b-a); // assuming that particles dont move more than 10 * domain size; this should call CUDA's fmod!
7272
}
7373
};
7474
};
@@ -242,6 +242,13 @@ namespace libcloudphxx
242242
thrust::plus<real_t>()
243243
);
244244

245+
// add total number of particles that fell out in this step
246+
output_puddle[common::outprtcl_num] +=
247+
thrust::reduce(
248+
n_filtered.begin(), // input start
249+
n_filtered.begin() + n_part // input end
250+
);
251+
245252
if(opts_init.chem_switch)
246253
{
247254
for (int i = 0; i < chem_all; ++i)

src/impl/particles_impl_chem_henry.ipp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ namespace libcloudphxx
352352
thrust::pair<
353353
typename thrust_device::vector<thrust_size_t>::iterator,
354354
typename thrust_device::vector<real_t>::iterator
355-
> np =
355+
> it_pair =
356356
thrust::reduce_by_key(
357357
sorted_ijk.begin(), sorted_ijk.end(),
358358
thrust::transform_iterator< // input - values
@@ -369,7 +369,7 @@ namespace libcloudphxx
369369
count_ijk.begin(),
370370
mass_new.begin()
371371
);
372-
count_n = np.first - count_ijk.begin();
372+
count_n = it_pair.first - count_ijk.begin();
373373
assert(count_n > 0 && count_n <= n_cell);
374374

375375
// apply the change to the mixing ratios of trace gases

src/impl/particles_impl_hskpng_count.ipp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ namespace libcloudphxx
2121
thrust::pair<
2222
thrust_device::vector<thrust_size_t>::iterator,
2323
thrust_device::vector<n_t>::iterator
24-
> n = thrust::reduce_by_key(
24+
> it_pair = thrust::reduce_by_key(
2525
sorted_ijk.begin(), sorted_ijk.end(), // input - keys
2626
thrust::make_constant_iterator(n_t(1)), // input - values
2727
count_ijk.begin(), // output - keys
2828
count_num.begin() // output - values
2929
);
30-
count_n = n.first - count_ijk.begin();
30+
count_n = it_pair.first - count_ijk.begin();
3131
assert(count_n <= n_cell);
3232
}
3333
};

0 commit comments

Comments
 (0)