Alternative to CUDA modeling

Discuss how polywell fusion works; share theoretical questions and answers.

Moderators: tonybarry, MSimon

Post Reply
mattman
Posts: 459
Joined: Tue May 27, 2008 11:14 pm

Alternative to CUDA modeling

Post by mattman »

Hello All,

CUDA is a very cool programming language developed by NVIDA. A number of people (Randy, Happyjack, CSI inc) have used it to simulate the polywell. CUDA will not run on my machine (I have no NVIDA graphics card).

Anyone know of an alternative?

I had a copy of MCNP6, but that is high level. I also have MATLAB. But, I really want to use something that someone has already setup for PIC simulations. It has tools, like meshing, Runge-Kutta-nystrom, ect... Upon investigation, I realized I have Randy's code for Visual basic 6. I also have Indrek Mare's code.

asdfuogh
Posts: 77
Joined: Wed Jan 23, 2013 6:58 am
Location: California

Re: Alternative to CUDA modeling

Post by asdfuogh »

If you want to do PIC simulations, you will have to use Fortran or C++. MatLab is okay because it's basically C++ (or can translate out to C++), but you'll want to eventually use one of the two big number cruncher languages. If you're doing this as an example, I would say Fortran is much easier to just pick up and go because it doesn't require the same kind of tweaking and optimizations as C++ (but don't trust me on this because this is what I know from colleagues because I only use Fortran for large scale simulations).

UC Berkeley has some open source codes in C++ (XOOPIC, for example): http://ptsg.egr.msu.edu/

I've not used them before, but I can only assume that it's set up for tokamaks or spheromaks right now (I think the ICF experiments at NIF are simulated by the code OSIRIS).

----------------------------------------------------

Also, CUDA is not so much a programming language as it is a programming model. It is parallel programming using the GPUs instead of CPUs (CPU paralleling programming is usually split into message-passing-interface [MPI] and open multi-processing [OpenMP]). General purpose GPU (GPGPU) is supposed to be the new star of parallel programming, and the newest top supercomputer, Tien-Hou 2, is based on this, if I remember correctly. GPGPU is mostly split into CUDA and OpenCL, where CUDA is only for NVidia architecture and OpenCL is cross-platform.

-----------------------------------------------------

Before you proceed further with this, I think you should highlight your goals in this simulation, and the amount of time you are willing to spend. There are various open-source codes out there, but most of them are specialized in some way (ie. for tokamaks, for ICF, for FRCs, for wakefield accelerators, etc.). If you want to simulate Polywell for a quick blog post, it might be better to do simple geometry that may reflect Polywell at one dimension or something simplified. If you want to simulate Polywell for the sake of proving some quantities, this will take a much, much longer time if you develop it from scratch. In that case, the quickest route would be to contact CSI for collaboration.. or anyone else who has worked with a Polywell simulation. A quick search shows Univ. of Madison-Wisc. scientists, J.F. Santarius and K.H. Simmons, as having published some results concerning a 2D PIC simulation on Polywell so maybe you can search more deeply to see what happened to that.

In addition to obtaining the code, you also have to verify its accuracy and validity by doing some test cases, as well as checking for a bunch of numerical convergences, especially if you want these results to be proof of physical quantities in Polywell.

If you want to try your hand at writing a PIC code, then you'll have to get the PIC bible written by Birdsall and Langdon, and maybe dip your toes by reading this blog (http://www.particleincell.com/blog/) which has a simple write up of an electrostatic PIC code. Finally, once you're ready to roll, you may want to consider some high performance computing cluster, and I think for a private small run, it's probably easiest to go with amazon (http://aws.amazon.com/hpc-applications/).

quixote
Posts: 130
Joined: Fri Feb 05, 2010 8:44 pm

Re: Alternative to CUDA modeling

Post by quixote »

mattman wrote:Anyone know of an alternative?
OpenCL. It's cross-platform so runs on both NVidia and AMD architectures.

https://www.khronos.org/opencl/

prestonbarrows
Posts: 78
Joined: Sat Aug 03, 2013 4:41 pm

Re: Alternative to CUDA modeling

Post by prestonbarrows »

Birdsall and Langdon is the best place to get the basics of PIC codes.

Cython is a good python package to get things running in C without having to actually learn C.
Pycuda or pyopengl are good python packages for crunching numbers on a GPU.
Numpy is a good middle ground for crunching large arrays of numbers with python without needing to compile to C or have a GPU.

You can write a PIC code in python, it will just be extremely slow for anything more than a demo. Open gl/Open cl are the alternatives to CUDA. In general, which one you can use depends if you have an ATI or nvidia GPU.

happyjack27
Posts: 1439
Joined: Wed Jul 14, 2010 5:27 pm

Re: Alternative to CUDA modeling

Post by happyjack27 »

OpenCL.

if you want to go just CPU (no GPGPU), on the choice between fortran and c++, definitely c++, with an open-source scientific library.

http://www.gnu.org/software/gsl/

for more options: http://stackoverflow.com/questions/3121 ... for-c-or-c

ohiovr
Posts: 431
Joined: Mon Mar 02, 2009 6:36 pm
Contact:

Re: Alternative to CUDA modeling

Post by ohiovr »

Can I have the cuda code for this? would be a lot of fun on my Tesla GPU :D

Proprietary? Aw shucks

Post Reply