Skip to content

Commit d6133fc

Browse files
committed
Added ExactDriftPass ExactMultipolePass ExactMultipoleRadPass
1 parent c087eb3 commit d6133fc

7 files changed

+32
-28
lines changed

atgpu/BndMPoleSymplectic4Pass.cpp

100755100644
File mode changed.

atgpu/CMakeLists.txt

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# AT GPU debugging project
22

3-
set(_CUDA OFF)
4-
set(_OPENCL ON)
3+
set(_CUDA ON)
4+
set(_OPENCL OFF)
55

66
cmake_minimum_required(VERSION 3.13)
77
project(AT_GPU)
@@ -16,8 +16,11 @@ set(SOURCE_FILES
1616
PassMethodFactory.cpp
1717
IdentityPass.cpp
1818
DriftPass.cpp
19+
ExactDriftPass.cpp
1920
StrMPoleSymplectic4Pass.cpp
21+
ExactMultipolePass.cpp
2022
StrMPoleSymplectic4RadPass.cpp
23+
ExactMultipoleRadPass.cpp
2124
BndMPoleSymplectic4Pass.cpp
2225
BndMPoleSymplectic4RadPass.cpp
2326
CavityPass.cpp
@@ -57,7 +60,7 @@ if(MSVC)
5760
include_directories($ENV{CUDA_PATH}/include ${OCL_SDK})
5861
link_directories($ENV{CUDA_PATH}/lib/x64)
5962
else()
60-
set(CMAKE_CXX_FLAGS "-O2 ${GPU_CXX_FLAGS}")
63+
set(CMAKE_CXX_FLAGS "-g ${GPU_CXX_FLAGS}")
6164
set(SOURCE_FILES ${SOURCE_FILES} PyInterface.cpp)
6265
set(PYTHON_INCL /usr/include/python3.8)
6366
set(PYTHON_LIB /usr/lib/python3.8)

atgpu/Element.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ typedef double AT_FLOAT;
1111

1212
// Type of lattice element
1313
// The define must be the corresponding class name in uppercase
14-
#define NB_PASSMETHOD_TYPE 8
14+
#define NB_PASSMETHOD_TYPE 11
1515
#define IDENTITYPASS 0
1616
#define DRIFTPASS 1
1717
#define BNDMPOLESYMPLECTIC4PASS 2
@@ -20,6 +20,9 @@ typedef double AT_FLOAT;
2020
#define STRMPOLESYMPLECTIC4RADPASS 5
2121
#define CAVITYPASS 6
2222
#define RFCAVITYPASS 7
23+
#define EXACTDRIFTPASS 8
24+
#define EXACTMULTIPOLEPASS 9
25+
#define EXACTMULTIPOLERADPASS 10
2326

2427
// Structure alignement
2528
#if defined(__CUDACC__) // NVCC

atgpu/Lattice.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ void Lattice::generateGPUKernel() {
230230
factory.generatePassMethodsCalls(code);
231231
code.append(" }\n");
232232
checkLostParticle(code);
233-
//code.append(" printf(\"%d: %f %f %f %f %f %f\\n\",elem,r6[0],r6[1],r6[2],r6[3],r6[4],r6[5]);\n");
233+
//code.append(" printf(\"%d %d: %f %f %f %f %f %f\\n\",turn,elem,r6[0],r6[1],r6[2],r6[3],r6[4],r6[5]);\n");
234234
code.append(" elem++;\n");
235235
code.append(" }\n");
236236

atgpu/PassMethodFactory.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#include "PassMethodFactory.h"
22
#include "DriftPass.h"
3+
#include "ExactDriftPass.h"
4+
#include "ExactMultipoleRadPass.h"
35
#include "StrMPoleSymplectic4RadPass.h"
46
#include "BndMPoleSymplectic4RadPass.h"
57
#include "RFCavityPass.h"
68
#include "AbstractGPU.h"
7-
#include <string.h>
8-
#include <iostream>
99
#include <algorithm>
1010

1111
using namespace std;
@@ -35,6 +35,9 @@ PassMethodFactory::PassMethodFactory(SymplecticIntegrator& integrator) noexcept:
3535
passMethodInfos[STRMPOLESYMPLECTIC4RADPASS] = REGISTER_PASS(StrMPoleSymplectic4RadPass);
3636
passMethodInfos[CAVITYPASS] = REGISTER_PASS(CavityPass);
3737
passMethodInfos[RFCAVITYPASS] = REGISTER_PASS(RFCavityPass);
38+
passMethodInfos[EXACTDRIFTPASS] = REGISTER_PASS(ExactDriftPass);
39+
passMethodInfos[EXACTMULTIPOLEPASS] = REGISTER_PASS(ExactMultipolePass);
40+
passMethodInfos[EXACTMULTIPOLERADPASS] = REGISTER_PASS(ExactMultipoleRadPass);
3841

3942
}
4043

atgpu/main.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,12 @@ void performanceTest(int gpu,string latticeName) {
225225
l->run(nbTurn, nbPart, rin, rout, nbRef, refs, nbStride, starts, lostAtTurn, lostAtElem, lostAtCoord,false);
226226
t1 = AbstractGPU::get_ticks();
227227

228-
//int pIdx = 0;
229-
//cout << "lostAtTurn[" << pIdx << "]" << lostAtTurn[pIdx] << endl;
230-
//cout << "lostAtElem[" << pIdx << "]" << lostAtElem[pIdx] << endl;
231-
//cout << "lostAtCoord[" << pIdx << "]" << lostAtCoord[pIdx*6+0] << "," << lostAtCoord[pIdx*6+1] << endl;
228+
AT_FLOAT *P = &rin[114*6];
229+
cout << "[" << 114 << "] " << P[0] << " " << P[1] << " " << P[2] << " " << P[3] << " " << P[4] << " " << P[5] << endl;
230+
cout << "Lost turn:" << lostAtTurn[114] << endl;
231+
cout << "Lost elem:" << lostAtElem[114] << endl;
232+
cout << "Lost coord:" << lostAtCoord[114*6] << "," << lostAtCoord[114*6+2] << endl;
232233

233-
AT_FLOAT *P;
234234
uint32_t strideSize = nbPart / nbStride;
235235
for(int stride=0; stride < nbStride; stride++) {
236236
P = ROUTPTR(stride*strideSize, 0, nbTurn - 1);
@@ -284,8 +284,9 @@ int main(int argc,char **arv) {
284284

285285
int DEVID = 0;
286286
//performanceTest(DEVID,"Z:/tmp/pons/at/test/lattice/betamodel_radon.repr");
287-
performanceTest(DEVID,"/segfs/tmp/pons/at/test/lattice/betamodel_radon.repr");
288-
//performanceTest(DEVID,"/segfs/tmp/pons/lattice/simple_ebs.repr");
287+
//performanceTest(DEVID,"/segfs/tmp/pons/at/test/lattice/betamodel_radon.repr");
288+
//performanceTest(DEVID,"/segfs/tmp/pons/at/test/lattice/betamodel_exact.repr");
289+
performanceTest(DEVID,"/segfs/tmp/pons/at/test/lattice/simple_ebs_radon.repr");
289290
//integratorTest(DEVID,"/segfs/tmp/pons/at/test/lattice/betamodel_radon.repr");
290291

291292
return 0;

setup.py

+8-14
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def select_omp():
138138

139139
c_pass_methods = glob.glob(join(integrator_src_orig, '*Pass.c'))
140140
cpp_pass_methods = glob.glob(join(integrator_src_orig, '*Pass.cc'))
141+
gpu_pass_methods = glob.glob(join('atgpu', '*Pass.cpp'))
141142
diffmatrix_source = join(diffmatrix_orig, 'findmpoleraddiffmatrix.c')
142143
at_source = join('pyat', 'at.c')
143144

@@ -192,20 +193,13 @@ def cpp_integrator_ext(pass_method):
192193
extra_compile_args=cflags
193194
)
194195

195-
gpusource = [join('atgpu', 'AbstractGPU.cpp'),
196-
join('atgpu', 'AbstractInterface.cpp'),
197-
join('atgpu', 'PyInterface.cpp'),
198-
join('atgpu', 'Lattice.cpp'),
199-
join('atgpu', 'PassMethodFactory.cpp'),
200-
join('atgpu', 'SymplecticIntegrator.cpp'),
201-
join('atgpu', 'IdentityPass.cpp'),
202-
join('atgpu', 'DriftPass.cpp'),
203-
join('atgpu', 'StrMPoleSymplectic4Pass.cpp'),
204-
join('atgpu', 'BndMPoleSymplectic4Pass.cpp'),
205-
join('atgpu', 'StrMPoleSymplectic4RadPass.cpp'),
206-
join('atgpu', 'BndMPoleSymplectic4RadPass.cpp'),
207-
join('atgpu', 'CavityPass.cpp'),
208-
join('atgpu', 'RFCavityPass.cpp')]
196+
gpusource = (gpu_pass_methods +
197+
[join('atgpu', 'AbstractGPU.cpp'),
198+
join('atgpu', 'AbstractInterface.cpp'),
199+
join('atgpu', 'PyInterface.cpp'),
200+
join('atgpu', 'Lattice.cpp'),
201+
join('atgpu', 'PassMethodFactory.cpp'),
202+
join('atgpu', 'SymplecticIntegrator.cpp')])
209203

210204
cudaext = Extension(
211205
name='at.tracking.gpu',

0 commit comments

Comments
 (0)