Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b837822
Separate the allocation and deallocation of data and terms for amplit…
Jun 11, 2026
4d5a86e
revisions to allow allocating a chunk of memory for amplitude calclat…
Jun 11, 2026
2210e0b
revise so that calAmplitudeAll can calculate amplitudes for a chunk o…
Jun 11, 2026
fd9118b
first attempt at a revision to allow calcIntegrals to be done in chun…
Jun 11, 2026
93e7f22
revision to compute generated integrals in parts rather than for the …
Jun 11, 2026
a1f0f1a
change array name to make consistent with other classes, add debug st…
Jun 15, 2026
5a4f960
change variable name to make use more clear
Jun 15, 2026
9abb7ac
fix bug where the wrong number of events was used in memory indexing
Jun 15, 2026
76a41da
typo fix in comment
Jun 15, 2026
a36c430
modify to pass information about need for user variables to loadData
mashephe Jun 17, 2026
40b2e38
modify to pass information about need for user variables to loadData
mashephe Jun 17, 2026
8664259
include math header
mashephe Jun 18, 2026
b7ab5b9
change event numbers to unsigned int
mashephe Jun 18, 2026
9b3dfae
enhance amplitude arguments for chunked calculations of amplitudes
mashephe Jun 18, 2026
f7f9a1d
change variable names to be more consistent
mashephe Jun 18, 2026
640db65
variable change to unsigned int and include functionality for chunked…
mashephe Jun 18, 2026
a538792
large revisions to enable chunked calculation of integrals
mashephe Jun 18, 2026
fb8fa68
modify arguments to calcIntegrals for generated MC
mashephe Jun 18, 2026
44c128d
revisions to manage GPU data
mashephe Jun 18, 2026
08644b2
clean up screen printing
mashephe Jun 18, 2026
c7203cf
change some variable names and fix arguments to assembleTerms
mashephe Jun 18, 2026
f2ede93
change type to unsigned int
mashephe Jun 18, 2026
0bd90bd
modify calcAmplitudeAll method in GPU manager to properly use the chu…
mashephe Jun 19, 2026
154386a
add additional debugging statement
mashephe Jun 30, 2026
1ae7ef3
fix bugs related to sharing of repeated data sets and getting the dat…
mashephe Jun 30, 2026
ba09a10
fix memory consuming problem with MPI jobs where lead node loads all …
mashephe Jun 30, 2026
25f5d93
add unit test products to gitignore
mashephe Jun 30, 2026
c9094fb
more clear comment
mashephe Jun 30, 2026
f261988
improve message printing to screen
mashephe Jun 30, 2026
9e4bfb2
add debugging statement
mashephe Jul 8, 2026
5475fef
functionality to improve memory use; GPU manager can share data on th…
mashephe Jul 8, 2026
2161ce5
fix indexing bug in user variables array when doing chunked amplitude…
mashephe Jul 8, 2026
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
15 changes: 14 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,17 @@ Tutorials/Dalitz/doc/*.aux
Tutorials/Dalitz/doc/*.log
Tutorials/Dalitz/doc/*.toc
Tutorials/Dalitz/doc/*.synctex.gz

UnitTests/AmpToolsInterfaceTest
UnitTests/AmpToolsInterfaceTest_GPU
UnitTests/AmpToolsInterfaceTestMPI
UnitTests/AmpToolsInterfaceTestMPI_GPU
UnitTests/configurationInfoTest
UnitTests/configurationInfoTest_GPU
UnitTests/fitResultsTest
UnitTests/fitResultsTest_GPU
UnitTests/fitResultsTestMPI
UnitTests/fitResultsTestMPI_GPU
UnitTests/parserTest
UnitTests/parserTest_GPU
UnitTests/writeModels
UnitTests/writeModels_GPU
2 changes: 2 additions & 0 deletions AmpTools/GPUManager/CUDA-Complex.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#ifndef __CUDA_COMPLEX__H__
#define __CUDA_COMPLEX__H__

#include <math.h>

#include "GPUManager/GPUCustomTypes.h"

#ifdef __CUDACC__
Expand Down
4 changes: 2 additions & 2 deletions AmpTools/GPUManager/GPUAmpProductKernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

__global__ void
amp_kernel( GDouble* pfDevAmps, GDouble* pfDevVVStar, GDouble* pfDevWeights,
int nAmps, int nEvents, double* pdDevRes )
int nAmps, unsigned int nEvents, double* pdDevRes )
{
int i = threadIdx.x + GPU_BLOCK_SIZE_X * threadIdx.y +
( blockIdx.x + blockIdx.y * gridDim.x ) * GPU_BLOCK_SIZE_SQ;
Expand Down Expand Up @@ -100,7 +100,7 @@ amp_kernel( GDouble* pfDevAmps, GDouble* pfDevVVStar, GDouble* pfDevWeights,

extern "C" void GPU_ExecAmpKernel( dim3 dimGrid, dim3 dimBlock,
GDouble* pfDevAmps, GDouble* pfDevVVStar, GDouble* pfDevWeights,
int nAmps, int nEvents, double* pdDevRes )
int nAmps, unsigned int nEvents, double* pdDevRes )
{
amp_kernel<<< dimGrid, dimBlock >>>( pfDevAmps, pfDevVVStar, pfDevWeights,
nAmps, nEvents, pdDevRes );
Expand Down
17 changes: 11 additions & 6 deletions AmpTools/GPUManager/GPUCustomTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,15 @@ using namespace std;

// a few helpers to make operations on GPU a little more user friendly

// standard arguments to kernel launches
// standard arguments to ampliutde kernel launches
#define GPU_AMP_PROTO GDouble* pfDevData, GDouble* pfDevUserVars, \
WCUComplex* pcDevAmp, int* piDevPerm, int iNParticles, int iNEvents
#define GPU_AMP_ARGS pfDevData, pfDevUserVars, pcDevAmp, piDevPerm, iNParticles, iNEvents
WCUComplex* pcDevAmp, int* piDevPerm, unsigned int iNParticles, \
unsigned int iNEvents, unsigned int startEvent
#define GPU_AMP_ARGS pfDevData, pfDevUserVars, pcDevAmp, piDevPerm, iNParticles, \
iNEvents, startEvent

// how to get the event we are working with:
// how to get the event we are working with -- this is within a chunk and is typically
// set to iEvent by the user
#define GPU_THIS_EVENT threadIdx.x + GPU_BLOCK_SIZE_X * threadIdx.y + \
( blockIdx.x + blockIdx.y * gridDim.x ) * GPU_BLOCK_SIZE_SQ

Expand All @@ -65,11 +68,13 @@ using namespace std;
#define GPU_PY 2
#define GPU_PZ 3

#define GPU_KIN(id,val) pfDevData[ ( piDevPerm[id] * 4 + val ) * iNEvents + iEvent]
// both the data and user vars are always stored for the entire data set so the indices
// need to be adjusted by startEvent when doing a chunked amplitude calculation
#define GPU_KIN(id,val) pfDevData[ ( piDevPerm[id] * 4 + val ) * iNEvents + iEvent + startEvent ]
#define GPU_P4(id) { GPU_KIN(id,GPU_E) , GPU_KIN(id,GPU_PX), \
GPU_KIN(id,GPU_PY) , GPU_KIN(id,GPU_PZ)}

#define GPU_UVARS(val) pfDevUserVars[val*iNEvents+iEvent]
#define GPU_UVARS(val) pfDevUserVars[val*iNEvents + iEvent + startEvent]

#define COPY_P4(a1,a2) GDouble a2[4]; for( int zzz = 0; zzz < 4; ++zzz ) a2[zzz] = a1[zzz];

Expand Down
24 changes: 12 additions & 12 deletions AmpTools/GPUManager/GPUFactPermKernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,29 @@
#include "GPUCustomTypes.h"

__global__ void
fact_perm_kernel( GDouble* pfDevAmps, GDouble* pcDevCalcAmp, int nFact,
int nPerm, int nEvents )
fact_perm_kernel( GDouble* pfDevAmps, GDouble* pcDevAmpFact, int nFact,
int nPerm, unsigned int nEvents )
{

int i = threadIdx.x + GPU_BLOCK_SIZE_X * threadIdx.y +
( blockIdx.x + blockIdx.y * gridDim.x ) * GPU_BLOCK_SIZE_SQ;

for( int iPerm = 0; iPerm < nPerm; ++iPerm ){

int offsetP = 2*nEvents*iPerm + 2*i;
unsigned int offsetP = 2*nEvents*iPerm + 2*i;

double ampRe = pcDevCalcAmp[offsetP];
double ampIm = pcDevCalcAmp[offsetP+1];
GDouble ampRe = pcDevAmpFact[offsetP];
GDouble ampIm = pcDevAmpFact[offsetP+1];

for( int iFactor = 1; iFactor < nFact; ++iFactor ){

int offsetF = 2*nEvents*nPerm*iFactor + offsetP;
unsigned int offsetF = 2*nEvents*nPerm*iFactor + offsetP;

double re = ampRe;
double im = ampIm;
GDouble re = ampRe;
GDouble im = ampIm;

ampRe = re * pcDevCalcAmp[offsetF] - im * pcDevCalcAmp[offsetF+1];
ampIm = re * pcDevCalcAmp[offsetF+1] + im * pcDevCalcAmp[offsetF];
ampRe = re * pcDevAmpFact[offsetF] - im * pcDevAmpFact[offsetF+1];
ampIm = re * pcDevAmpFact[offsetF+1] + im * pcDevAmpFact[offsetF];
}

pfDevAmps[2*i] += ampRe;
Expand All @@ -71,8 +71,8 @@ fact_perm_kernel( GDouble* pfDevAmps, GDouble* pcDevCalcAmp, int nFact,
}

extern "C" void GPU_ExecFactPermKernel( dim3 dimGrid, dim3 dimBlock,
GDouble* pfDevAmps, GDouble* pcDevCalcAmp, int nFact, int nPerm, int nEvents )
GDouble* pfDevAmps, GDouble* pcDevAmpFact, int nFact, int nPerm, unsigned int nEvents )
{
fact_perm_kernel<<< dimGrid, dimBlock >>>( pfDevAmps, pcDevCalcAmp,
fact_perm_kernel<<< dimGrid, dimBlock >>>( pfDevAmps, pcDevAmpFact,
nFact, nPerm, nEvents );
}
10 changes: 5 additions & 5 deletions AmpTools/GPUManager/GPUKernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@

extern "C" void GPU_ExecAmpKernel(dim3 dimGrid,dim3 dimBlock,GDouble* pfDevAmps,
GDouble* pfDevVVStar, GDouble* pfDevWeights,
int nAmps, int nEvents, double* pfDevRes);
int nAmps, unsigned int nEvents, double* pfDevRes);

extern "C" void GPU_ExecFactPermKernel( dim3 dimGrid, dim3 dimBlock,
GDouble* pfDevAmps, GDouble* pcDevCalcAmp,
int nFact, int nPerm, int nEvents );

GDouble* pfDevAmps, GDouble* pcDevAmpFact,
int nFact, int nPerm, unsigned int nEvents );

extern "C" void GPU_ExecNICalcKernel( dim3 dimGrid, dim3 dimBlock, unsigned int sharedSize,
int nElements, double* pdDevNICalc,
GDouble* pfDevAmps, GDouble* pfDevWeights,
int nEvents, int nTrueEvents, unsigned int maxSize );
unsigned int startEvent, unsigned int nEvents,
unsigned int nTrueEvents, unsigned int maxSize );

#endif //__GPU_KERNEL__H__
Loading
Loading