-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #163 from taiga-project/bugfix-22
Bugfix 22
- Loading branch information
Showing
16 changed files
with
218 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef TAIGA_CUDA_CUH | ||
#define TAIGA_CUDA_CUH | ||
|
||
#define CHECK_ERROR(cuda_code) { manage_cuda_error((cuda_code), __FILE__, __LINE__); } | ||
|
||
void set_cuda(int debug_flag); | ||
|
||
inline void manage_cuda_error(cudaError_t cuda_code, const char *filename, int line) { | ||
if (cuda_code != cudaSuccess) { | ||
fprintf(stderr,"CUDA ERROR in %s (line %d):\n %s\n", filename, line, cudaGetErrorString(cuda_code)); | ||
} | ||
} | ||
|
||
#endif //TAIGA_CUDA_CUH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef TAIGA_FREE_CUH | ||
#define TAIGA_FREE_CUH | ||
|
||
#define HOST 0 | ||
#define SHARED 1 | ||
#define DEVICE 2 | ||
#define FREE(where, p) { \ | ||
if (where == HOST) {free(p);} \ | ||
else {CHECK_ERROR(cudaFree(p));} \ | ||
} | ||
#define FREE_MAIN(where, p) { \ | ||
if (where == DEVICE) {CHECK_ERROR(cudaFree(p));} \ | ||
else {free(p);} \ | ||
} | ||
|
||
void free_taiga(TaigaGlobals *host_global, TaigaGlobals *shared_global, TaigaGlobals *device_global, | ||
TaigaCommons *host_common, TaigaCommons *shared_common, TaigaCommons *device_common, | ||
DetectorProp *shared_detector, DetectorProp *device_detector, | ||
ShotProp *shot, BeamProp *beam, RunProp *run, | ||
double *host_service_array, double *device_service_array); | ||
|
||
void free_detector(DetectorProp *detector, int where); | ||
void free_beam(BeamProfile *beam_profile, int where); | ||
void free_global(TaigaGlobals *taiga_global, int where); | ||
void free_common(TaigaCommons *shared_common, int where); | ||
|
||
#endif //TAIGA_FREE_CUH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
#include <cuda.h> | ||
#include "core/init/generate_coords.cuh" | ||
#include "utils/physics.h" | ||
#include "utils/cuda.cuh" | ||
|
||
void init_fastmode(BeamProp beam, ShotProp shot, RunProp run, TaigaGlobals *device_global){ | ||
BeamProfile *device_prof; | ||
size_t size_prof = sizeof(BeamProfile); | ||
cudaMalloc((void **) &device_prof, size_prof); | ||
CHECK_ERROR(cudaMalloc((void **) &device_prof, size_prof)); | ||
init_beam_profile(device_prof, shot); | ||
generate_coords <<< run.block_number, run.block_size >>> (device_global, beam, device_prof, get_mass(beam.species, beam.charge)); | ||
CHECK_ERROR(cudaFree(device_prof)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.