-
Notifications
You must be signed in to change notification settings - Fork 9
Release/integrate gpu #2
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
Merged
Merged
Conversation
This file contains hidden or 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
- New folder/file structure - Moved data from gpu_pic to this repo - Moved 'old' files to subfolder old - Tested CPU version (GPU todo)
- Adopted FD_Staircase_SquareGrid to the new interface. Some things
still to be solved:
-> Works only with an odd number of gridpoints due to symmetry
required by the chamber/aperture/...
- New setup.py to compile the fortran functions
To be done: Somehow incorporate the fortran functions (rhocompute...)
into the new interface
- FD solvers (except Shortley_Weller_extrapolation) work for symmetric problems as defined in the test file - Todo: Check for asymetric problems
- Gradient was computed using a dx,dy,dz=1 => changed to use mesh.dx etc
- M2P and P2M Fortran versions used in the PyPIC
- Created an interactive test out of the 000_test_round_chamber.py file -> looks good so far (minor modification in FD_solver.py: remove list_internal_force_zero as it is not needed
- Test the solve() times of the new interface --> not slower
- FFT open boundary 'works': - Results are off by a factor of 2, otherwise ok. To check!
- FiniteDifferences_ShortleyWeller_SquareGrid field comp. was wrong (ex, ey were exchanged). Fixed by swapping the two arrays. This is due to the Fortran/C ordering etc
- Fix copy & paste typo in the notebook -> the wrong fields were plotted
- Rewrote parts of the test to avoid copy/paste errors (functions, ...) - FiniteDifference_ShortleyWeller_SquareGrid: Add ext_boundary as paramateter to init. Not implemented before.
- Add the timing of the FFT_SquareGrid_OpenBoundary to the timings notebook
- Fixed the gradient implementation of the two shortley weller implemementations: 1) reshaping phi similar to the other functions 2) extrapolation: fix indentation error! With this version both FD staircase, shortley weller, shortley weller extrapolation and FFT open boundary work.
- Implements new interface for the FFT periodic boundary solver - 'Magically' fixes the problem of the new/old FFT open boundary problem yielding a factor of 2 difference. (multiply by 2...) ---> !! TO BE INVESTIGATED
- Draft of the proxy class for the solvers providing the interface of the old 1.0.2 solvers. The child classes should initialize the proper pypic solver and pass it to the parent class. Not tested yet
- Added the necessary import to all test files - Fixed mistakes in the pyfftw implementation of FFT_PEC - Minor fix in FD_solver: / -> // in the printing of the mat assembly - Notebook to test the backwards compatibility. Note that there's still an error at the boundaries for the ShortleyWeller implementation (observable in 000, 008, ...) TO FIX
…/PyPIC into new_pypic_gpu_and_cpu - merge Adrians changes and my local ones (backwards compatibility)
- Remove some unnecessary code in pypic.py ERRORS in the fft tests (see e.g. 000_round_chamber: problems with the shape of efx and efy) Fix later
- Skeleton (not tested) implementation of the gpu fft open boundary solver
- 3D fft using cuda fft implemented, first simple tests work - ipython notebook to test the new functionality
- created a fft poissonsolver using numpy fftn for debugging purposes - fixed mistakes: normalize cufft result Still not the same as analytical solution, the error is the biggest for small r and grows with the inverse standard deviation of the gaussian beam distribution
takes tuples instead of single numbers for origin, cell dimensions and number of cells per direction. Unifies signature of meshes.
check for is None instead of False in pypic.py
Makes pic_solve run 20% faster on GPU (138s vs. 110s on K40m). Also required by Gianni's approach.
- Removed a very old test: Everything has changed since the test was written. - Update the fft_3d_gpu test to the new mesh interface, clean it --> works
was e before but should be charge from keywords.
- Implemented off-the-grid check for p2m atomicadd and m2p variants ---> works now if not all particles are on grid - Implemented atomicadd 32bit hardware accelerated variant. ---> is now the default, 64bit double precision is slower and can be used explicitly by giving the kwarg dtype in pypic.particles_to_mesh() - Fixed shape --> shape_r in mesh_to_particle (barely used function, usually we use fields_to_particle, there it was correct) NB: still experience too large total sum of mesh_charges when using sorted_particles_to_mesh in conjunction with PyHEADTAIL on feature/PyPIC-integration branch, atomicadd variants work properly.
distances and recalculate the integrated Green's function. Needed for adaptive meshing.
Introduced setup_mesh method in 2.5D FFT solver and minor stuff around state saving in PyPIC.
PyHEADTAIL uses Nearest-Grid-Point (zero-order floor) interpolation in the longitudinal plane, while the RectMesh3D uses first-order linear Cloud-In-Cell interpolation. This leads to differing n_macroparticles_per_slice in the longitudinal plane. RectMesh25D implements NGP interpolation along z to recover the SliceSet behaviour. Note: the last mesh node is always disregarded during the PIC, therefore there should be one more z mesh node than slices used in PyHEADTAIL.
(sorting is implemented in PyHEADTAIL via the thrust interface)
get_weights is 4x quicker in cython than in numpy for the CPU and 30x quicker for a lumped ElementwiseKernel than in single operations for the GPU. This should be incorporated in standard meshing.
Prepares for simplification of m2p / p2m and mesh kernels. They should go all together.
lgiacome
pushed a commit
to lgiacome/xfields_old
that referenced
this pull request
Oct 17, 2023
Release/v0.5.0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Integrate
feature/GPUbranch into master as a subdirectory.