Skip to content

tmbeardsley/lfts_gpu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Langevin Field-Theoretic Simulation of Diblock Copolymers on GPUs

Description

See https://www.tbeardsley.com/projects/lfts/fts_gpu for a detailed discussion of this project.

Lamellar Cylindrical Spherical Gyroid Fddd

Required Dependencies

GSL - GNU Scientific Library (https://www.gnu.org/software/gsl/)
CUDA Toolkit (https://developer.nvidia.com/cuda-toolkit/)

Compiling

Two methods of compiling the program are available:

  1. comp.sh
    A simple bash script to create a 'build' directory containing the compiled program code: lfts-gpu.

    On a Linux system, run the bash script from the top directory via:
    sh comp.sh

  2. CMake
    CMakeLists.txt specifies the required commands for CMake to create (and run) Makefiles, which create a 'build' directory and compile the program code as: lfts-gpu.

    From the top directory, run:
    cmake -B build
    cmake --build build

Running the program

After compilation the executable file, lfts-gpu, resides in the 'build' directory. An input file must be supplied to the executable at the command line, examples of which are contained in the 'input_files' folder. For example, from the top level of the directory tree, the program could be run via:

./build/lfts-gpu ./input_files/input

Input Files

The input_files directory contains example input files that can be supplied to the program from the command line.

Input file format

Line 1: N NA XN C Ndt isXeN
Line 2: mx my mz Lx Ly Lz
Line 3: n_eq n_st n_smpl save_freq loadType
Lines 4->(M+3): W-(r)
Lines (M+4)->(2M+3): w+(r)

Note: A real-space position r = (x,y,z) corresponds to a mesh point position r_m = (i,j,k), where i=0->mx-1, j=0->my-1 and k=0->mz-1 are integers. The elements of the fields, W-(r) and w+(r), are then written in ascending order of the row-major index: p = mx*(i*my+j)+k.

Parameter descriptions

Parameter Type Description
N Integer Number of monomers in a single polymer chain
NA Integer Number of monomers in the A-block of a polymer chain
XN Double Interaction strength between A and B-type monomers
C Double Square root of the invariant polymerisation index, Nbar
Ndt Double Size of the time step in the Langevin update of W-(r)
isXeN Integer Whether the parameter XN is in terms of bare (isXeN=0) or effective (isXeN=1) chi
mx, my, mz Integers Number of mesh points in the x, y, and z dimensions of the simulation box
Lx, Ly, Lz Doubles Dimensions of the simulation box (in units of the polymer end-to-end length, R0) in the x, y, and z dimensions
n_eq Integer Number of langevin steps performed to equilibrate the system
n_st Integer Number of langevin steps performed after equilibration has ended, during which statistics are sampled
n_smpl Integer Number of steps between samples being taken in the statistics period
save_freq Integer Number of steps between saving outputs to file
loadType Integer Whether to load the W-(r) and w+(r) fields from the proceeding file lines (loadType=1), start from a disordered state (loadType=0) or start from a (300) lamellar phase (loadType=2)
M Integer Total number of mesh points (M = mx*my*mz), such that the proceeding 2*M lines of the file can hold the W-(r) and w+(r) fields to be loaded

Output files

w_eq_<step_number>

The state of the W-(r) and w+(r) fields at simulation step number <step_number> during the equilibration period. First three lines are simulation parameters so it can be used as an input file.

w_st_<step_number>

The state of the W-(r) and w+(r) fields at simulation step number <step_number> during the statistics gathering period. First three lines are simulation parameters so it can be used as an input file.

phi_eq_<step_number>

The state of the phi-(r) and phi+(r) fields at simulation step number <step_number> during the equilibration period.

phi_eq_<step_number>

The state of the phi-(r) and phi+(r) fields at simulation step number <step_number> during the statistics gathering period.

Performance

Time per simulation step (GPU vs. CPU) Speedup (TCPU/TGPU)
Average time taken per simulation step in the gpu and cpu L-FTS codes as a function of the linear mesh dimension, m, for cubic grids with mγ=m and γ=x,y,z. Note the logarithmic scales on the x and y axes. Speedup of the gpu L-FTS code relative to the cpu version vs the linear mesh dimension, m, for cubic grids with mγ=m and γ=x,y,z. Note the logarithmic scales on the x and y axes.