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

Add support for building GPU-enabled GalSim using NVIDIA compiler #1230

Merged
merged 4 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def all_files_from(dir, ext=''):
}
lopt = {
'gcc' : ['-fopenmp'],
'gcc w/ GPU' : ['-fopenmp','-foffload=nvptx-none'],
'gcc w/ GPU' : ['-fopenmp','-foffload=nvptx-none', '-foffload=-lm'],
'icc' : ['-openmp'],
'clang' : ['-stdlib=libc++'],
'clang w/ OpenMP' : ['-stdlib=libc++','-fopenmp'],
Expand Down
8 changes: 8 additions & 0 deletions src/Silicon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,9 @@ namespace galsim {
// Get the location where the photon strikes the silicon:
double x0 = photonsX[i]; // in pixels
double y0 = photonsY[i]; // in pixels
#ifdef DEBUGLOGGING
jamesp-epcc marked this conversation as resolved.
Show resolved Hide resolved
xdbg<<"x0,y0 = "<<x0<<','<<y0;
#endif

// get uniform random number for conversion depth from randomArray
// (4th of 4 numbers for this photon)
Expand All @@ -1390,10 +1392,14 @@ namespace galsim {
x0 += dxdz * dz_pixel; // dx in pixels
y0 += dydz * dz_pixel; // dy in pixels
}
#ifdef DEBUGLOGGING
xdbg<<" => "<<x0<<','<<y0;
#endif
// This is the reverse of depth. zconv is how far above the substrate the e- converts.
double zconv = _sensorThickness - dz;
#ifdef DEBUGLOGGING
xdbg<<"zconv = "<<zconv<<std::endl;
#endif
if (zconv < 0.0) continue; // Throw photon away if it hits the bottom
// TODO: Do something more realistic if it hits the bottom.

Expand All @@ -1405,7 +1411,9 @@ namespace galsim {
x0 += diffStep * randomArray[(i-i1)*4];
y0 += diffStep * randomArray[(i-i1)*4+1];
}
#ifdef DEBUGLOGGING
xdbg<<" => "<<x0<<','<<y0<<std::endl;
#endif
double flux = photonsFlux[i];

#ifdef DEBUGLOGGING
Expand Down
Loading