Skip to content

Commit 8dd292c

Browse files
authored
Merge pull request #1205 from HannoSpreeuw/1195_fix
1195 fix cheked by Erwan, and considered ok.
2 parents e4f8659 + b47d5ad commit 8dd292c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/sapporo_light/dev_evaluate_gravity.cu

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ __device__ void body_body_interaction(float &ds_min,
7373

7474
}
7575

76-
float inv_ds = rsqrt(ds2 + EPS2) * (__float_as_int(pos_i.w.y) != __float_as_int(pos_j.w.y));
76+
float inv_ds = 0.0f;
77+
if (__float_as_int(pos_i.w.y) != __float_as_int(pos_j.w.y)) {
78+
inv_ds = rsqrt(ds2 + EPS2);
79+
}
80+
7781
float mass = pos_j.w.x;
7882
float inv_ds2 = inv_ds*inv_ds; // 1 FLOP
7983
float inv_ds3 = mass * inv_ds*inv_ds2; // 2 FLOP

lib/sapporo_light/send_fetch_data.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void sapporo::free_cuda_memory(int ignore) {
2323
CUDA_SAFE_CALL(cudaFree( (void*)dev.ngb_list_i));
2424

2525

26-
CUDA_SAFE_CALL(cudaThreadExit());
26+
CUDA_SAFE_CALL(cudaDeviceReset());
2727
CUT_CHECK_ERROR("Failedn");
2828
}
2929

0 commit comments

Comments
 (0)