Repository navigation
Home
The cuPSS library is in a very early stage of development but is already capable of solving a wide range of coupled stochastic PDEs.
It does so by numerically integrating PDEs in Fourier space, and thus is particularly good for problems with high order derivatives in which real space formulations might lead to instabilities due to the discretization of gradients.
cuPSS runs natively in CUDA, where 1D or 2D problems are treated as textures. This makes it potentially faster than other packages without this type of hardware acceleration.
cuPSS relies on FFTW3 and several of the standard CUDA toolkit libraries. Install FFTW3 with single floating point precision. Download from fftw3's website here. Decompress in a directory and run
./configure --enable-float
make
sudo make install
To install the CUDA toolkit, follow the instructions in their website
Make sure the toolkit installed matches the version of the NVIDIA drivers. CUDA will work and run sometimes with mismatching versions, without making it clear there are any errors. Run nvidia-smi to check the CUDA Version, on the top right, and download the matching CUDA toolkit.
A piece of cuPSS relies on the standard filesystem header file to create data directories. This is standard in c++17 and beyond, so compile cuPSS solvers under this standard.
Once the dependencies have been installed, cuPSS can be tried by cloning the repository
git clone https://github.com/fcaballerop/cuPSS.git
To compile and install system-wide, CMake can be used, run the following commands in the cuPSS directory.
mkdir build
cd build
cmake ../
cmake --build .
sudo cmake --install .
cd ..
Try one of the example solvers, compile linking the appropriate libraries
nvcc examples/cahn-hilliard.cpp -lcufft -lfftw3f -lcurand -lcupss -O2 -o cahn-hilliard
./cahn-hilliard
The output files will be in a directory called data, in the directory where the executable is. These files can be analysed or plotted with any software.
If CMake is not available, or system-wide installation is not possible, cuPSS can be compiled locally int a static library to then be linked to any solver. To do so, the source files can be compiled to object files and packed into a library by running
cd src
nvcc -c *cu *cpp -O2
ar rcs libcupss.a *.o
cd ..
The library will be in the directory src/, and can be linked to any solver. The header file to include will then be in the inc directory. Try compiling an example solver
nvcc examples/cahn-hilliard.cpp -Lsrc/ -lcufft -lfftw3f -lcurand -lcupss -O2 -o cahn-hilliard
./cahn-hilliard
The executable will run and output data in directory called 'data' located where the executable is.
cuPSS can solve a system of
where each
Nonlinearities are calculated pseudospectrally to avoid explicitly calculating convolutions in Fourier space.
See tutorials for example on how to write solvers using cuPSS.
The equations are integrated in time by simple Euler steps in Fourier space. Linear terms can be integrated through forward or backward steps. Nonlinear terms are integrated through forward steps. Nonlinear terms are integrated pseudospectrally, meaning, each field that is multiplied in the nonlinear term will be transformed back to real space, then the nonlinearity is computed by multiplying its components in real space, and then the result is transformed back to real space. Before the first transformation to real space, fields are dealiased. Explicitly, a nonlinear term of the form
where