Sunday, 20 December 2015

A Quick Start to Using SMAUG

Guidelines for Using Sheffield Magnetohydrodynamics Algorithm Using GPUs (SMAUG)


Parallel magnetohydrodynamic (MHD) algorithms are important for numerical modelling of highly inhomogeneous solar and astrophysical plasmas. SMAUG is the Sheffield Magnetohydrodynamics Algorithm Using GPUs. SMAUG is a 1-3D MHD code capable of modelling magnetised and gravitationally stratified magnetised plasma. The methods employed have been justied by performance benchmarks and validation results demonstrating that the code successfully simulates the physics for a range of test scenarios including a full 3D realistic model of wave propagation in the magnetised and stratified solar atmosphere. For details about smaug see the preprint at: smaugpreprint
SMAUG is based on the Sheffield Advanced Code (SAC), which is a novel fully non-linear MHD code, designed for simulations of linear and non-linear wave propagation in gravitationally strongly stratified magnetised plasma. See the reference at the Astronomy Abstracts Service. sacpaper
The smaug code has been developed by the Solar Wave theory group SWAT at The University of Sheffield. Researchers and users downloading the code are requested to acknowledge and give credit to the Solar Physics and Space Plasma Research Centre (SP2RC) at The University of Sheffield.


CUDA-Enabled Tesla GPU Computing Product with at least compute capability 1.3.
CUDA toolkit
The SMAUG has been developed and tested on a range of different 64 bit (and 32 bit ) linux platforms.
Guidelines for correct installation of the CUDA toolkit and drivers can be found at cudagettingstarted


SMAUG can be downloaded in 3 ways
  • Download and extract the latest tarball from the google code site
  • Checkout the distribution from the user release version from the google repository. This is recommended if you require regular updates and bugfixes.
  • Checkout the distribution from the developer repository. This is recommended if you wish to participate in the development of future code versions.
Method 1:
Download the distribution Link to revision 257 source code
Copy the distribution to a suitable directory in your working area and extract the distribution tar -zxvf smaug_v1_rev255.tgz
Method 2:
Create a directory and from that directory,
using a subversion client checkout the latest distribution using the command:
svn checkout
when prompted, Password for 'anonymous' just press return.

Building and running a Model

From the distribution base directory change directory to the src folder.
Building a smaug based simulation requires the use of the make utility. The make may be tuned for a particular platform by editing the include line near the top of the file.
The default input file is make_inputs. If you are building an MPI distributionthen edit this line and use make_inputs_mpi. Any particular options can be edited within the make_inputs file. It is most likely that the library path for the cuda libraries is set correctly. This can easily be changed by editing the CUDA.
The make_inputs file includes a number of compiler switches the smaug specific switches used for both the host compiler and cuda compiler are as follows.
USE_SAC            //Set this to build and compile 2D models
USE_SAC_3D         //Set this to build and compile 3D models
USE_MULTIGPU       //Set this to build for multi GPU models (e.g. if you are using MPI)
USE_MPI            //Set this if you are using MPI (need to set the host                           compiler to a suitabel MPI compiler)
USE_USERSOURCE     //Set this if you are using user provide source terms
The cuda specific switches are as follows
--ptxas-options=-v Provide verbose output when generating CUDA code -arch sm_20 Set the correct CUDA architecture (sm_20 allows printf debugging in CUDA kernels) -maxregcount=32 Set the numbe of register variables for the CUDA compiler
To make the Brio-Wu test (use the following commands)
make clean make bw make sac
Change back to the distribution base directory
Run the model
./iosmaug a
As each step is run the program outputs the current simulation time step, iteration and the time taken to compute that step. Generated configuration files are written to the out directory. These may be visualised with IDL using the procedures in the Idl directory.
For the Brio-Wu test use
For the Orszag-Tang test use
The test models available are as follows. The code used with make to make the model is shown in the second column
1d Brio-Wu bw
2d Orszag-Tang ot 2d Kelvin-Helmholtz test kh
These tests have pre-prepared configuration files and should run by default. Configuration files may be generated using either SAMUG or the vacini routine with VAC or SAC. SMAUG generates binary output files but currently takes as input ascii configuration files. IDL procedures in the Idl folder are available to translate configuration data as required.

Modifying The Run Parameters

To change the input parameters edit the file iosmaugparams.h in the include folder. At any time you can revert to the default parameters for the OT test (or a particular model) by changing to the src folder and issuing the command
make ot
As soon as the parameter files have been updated, move to the src folder and recompile the model using
make smaug
Move back to the base directory and run the model.
The following parameters can be altered in the iosmaugparams.h file
ni,nj,nk           //size of the domain (note this will be shifted by 2X the number of ghost cells)
xmax, ymax, zmax   //the physical domain size for each direction
xmin, ymin, zmin

cfgfile             //The name and path of the input configuration file
cfgout              //The name and path of the output configuration file              (each file generated will
                     //be appended with an integer denoting the step index)

dt                  //The time step (if using fixed)
nt                  //Number of iterations to perform

p->gamma            //The adiabatic constant
p->courant          //The courant parameter used to determine the time step parameter
p->moddton          //Set to 0.0 for fixed time steps setto 1  to enable
p->hyperdifmom      //Set to 1.0 to switch hyperdiffusion stabilisation on 0.0 disables
p->readini          //Set to 1.0 to read initial configuration from an input file. 
                    //The 0.0 will generate a configutation using the default if provided
                    //or written by the user.
The hypediffusion parameters may be altered slightly but it is recommended to leave them at their default tuned settings.
Boundary types are also set here according to field variable, direction and top or bottom boundary. The boundary conditions may also be user configured as briefly outlined in the following section.

Guidelines for Users Developing Customised Models

Users wishing to develop customised models require a basic knowledge of C programming. An indepth knowledge of CUDA programming is not required.
The following source files may be modified by the user.
iosmaugparams.h initialisation_user.h
The above files can be appended with a .mymodelname and stored in the models folder. The Makefile should be updated by including the following lines.
cp ../models/iosmaugparams.h.mymodelname ../include/iosmaugparams.h
cp ../models/ ../src/
cp ../models/ ../src/
cp ../models/ ../src/
cp ../models/initialisation_user.h.default ../include/initialisation_user.h
The custome model can then be set using
make mymodelname
Further details about building and compiling use defined models will be provided on line.
iosmaugparams.h Contains parameter settings Contains code which can be used to initialise a configuration on the GPU Allows the user to define which boundary conditions called and how they will be called Allows the user to include additional source terms (for example velocity driver terms) initialisation_user.h Allows the user to provide custom code generating a configuration on the host machine.
This is useful when a user needs to generate configurations scattered across multiple GPU's

Help Support

The developers may be contacted directly

No comments:

Post a Comment