Showing posts with label cluster. Show all posts
Showing posts with label cluster. Show all posts

Wednesday, October 26, 2011

Performance Analysis of NAMD on NVIDIA GPU

Abstract

As GPU become readily available resources in high performance computing environment, more and more applications are being considered to be a target application for taking advantage of highly parallel computing capability of GPU. To evaluate the performance improvement in application level, molecular dynamics applications, NAMD, is experimented in this article and its performance has been analyzed in three different perspectives: Scalability, speedup, and GPU utilization.

1. Experimental environment

GPU nodes are relatively new addition to the existing EOS system at Texas A&M University. Table 1 shows detail of the node tested in this experiment. It has two six core 2.8Ghz Intel Xeon X5660 processors based on Westmere architecture and 24GB DDR3 DRAM with 1,333Ghz clock cycle. Additionally, it is equipped with two NVIDIA M2050 GPU devices. Each M2050 GPU device runs at 1.15Ghz and 2687MB GDDR5 memory with 1.546Ghz clock cycle. M2050 is a high performance grade device with 14 streaming multiprocessors and each of them has 32 cores which is based on Fermi architecture. It also has ECC memory error protection, and L1 and L2 cache to provide not only accuracy but also high performance on computation. The node is running 64-bits Red Hat Enterprise Linux Server release 5.4.

NAMD has been tested on three configurations. First, it is executed with CPU only configuration. Secondly, it is executed with 1 NVIDIA M2070 GPU. Finally, it is executed with 2 NVIDIA M2050 GPUs. Since these tests are submitted through batch system and there is no guarantee that each test ran exclusively on compute node and compute node could be shared by several other jobs as well. Therefore, the performance presented in this article could be different from exclusive testing environment.


NVIDIA
M2050
NVIDIA
M2070
INTEL
X5660
Clock speed(GHz)
1.15
1.15
2.8
Memory(GB)
2.687
5.375
24.081
Memory Clock(GHz)
1.546
1.566
1.333
# of CUDA cores
448
448
N/A
CUDA Driver ver.
4.0
4.0
N/A
CUDA CC ver.
2.0
2.0
N/A
Table 1: Specification of experimental environment

To benchmark NAMD, apoa1 dataset is used in experiment. This dataset contains 92,000 atoms and simulates 500 steps. Among several parameters in input file, outputEnergies set to 100 as suggested in user manual to remove unnecessary CPU involvement for generating additional output in file.

2.Results

In this section, performance of NAMD has been analyzed in three aspects: Scalability, speedup, and GPU utilization.

A.Scalability

The ratio of CPU cores and GPU is 12:1 on single GPU node and 12:2 on multi GPU node. Each process of NAMD occupy one CPU core and 1 GPU. However, GPU can be shared by multiple process. Therefore, it is possible that GPU can be oversubscribed by too many processes and become bottleneck in certain configuration.
Figure 1

Since each process on NAMD maps to single CPU cores, number of cores means same as number of process in graph. CPU version of NAMD scales well up to 12 cores on Westmere node in Figure 1. However, GPU version of NAMD shows best performance around 4-6 cores. On 1 GPU nodes, all processes invoke kernel on same GPU concurrently, so it breaks scalability when there is 12 processes.

B.Performance

Figure 2 shows relative speedup of GPU version compared to CPU only version. Suppose the performance of CPU only version with 1 core is 1x. With 1 CPU core and 1 GPU, NAMD runs 7 times faster than CPU only version. With 2 CPU cores and 1 GPU, NAMD runs 13 times faster. While CPU version scales up well until 12 cores, GPU version hits the peak around 6 cores and starts falling.
Figure 2
C.GPU Utilization 

1)Single GPU environment 

Figure 3 shows how utilization of single GPU changes as the number of CPU core increases. With 1 CPU core, GPU uses only 30% of its capability. In other words, 70% of GPU is not doing anything and just stay idle. However, if there are 2 CPU cores, GPU is shared by these 2 cores and overall utilization has been doubled up to around 60%. Likewise, utilization goes over 90% when 4 CPU cores share GPU.
Figure 3
It turned out that higher GPU utilization directly affects on application’s performance as shown in Figure 2. With 2 CPU cores, NAMD runs twice faster than 1 CPU core.

2)Multi GPU environment

Among two graphs in Figure 4, top one shows utilization of first GPU and bottom one shows utilization of second GPU. The fact that two graphs look very similar each other represents NAMD distributes workload evenly to multiple GPU for computation. With 2 CPU cores, utilization of each GPU stays around 40%. With 4 CPU cores, utilization of each GPU goes up over 60%.
Figure 4
IV Conclusions

GPU application shows different performance charac-teristics from CPU application. Scalability can be affected by the ratio of CPU core and GPU. Oversubscribing GPU can limit the scalability of application. On multi GPU node, the overall speedup is affected by how application distribute workload to each GPU device. At the same time, under-subscribing GPU device, such as workload is not big enough to keep all GPU devices busy, is also limit the performance of GPU application.


Tuesday, November 9, 2010

Matlab DCS + Torque : What's missing?

Matlab Distributed Computing Server directly supports Torque scheduler with minimum configuration. However, when it passes parameter such as number of CPU to Torque, it only allows passing one parameter using '^N^' keyword, which is defined in 'ResourceTemplate' at 'Scheduler Configuration Properties' window.

Unfortunately, Torque, in general, needs two parameters to specify number of CPU in this format to submit multi-nodes job.

nodes=X:ppn=Y

where X denotes number of node, Y denotes processor per node, respectively.

Torque set ppn to 1 by default if it is not explicitly specified. In other words, 4 way job result in

nodes=4:ppn=1

instead of

nodes=1:ppn=4

which is ideal for system having node with 4 cores each.

I needed a Matlab function that can handle this conversion between Matlab user and Matlab Distributed Computing Server.

TASKLAYOUT(X,Y) takes one parameter and claculates optimal way to define X, Y values and constructs right string which can be used by 'psub' command internally.

For example, assume each node has 8 cores, then TASKLAYOUT(X,Y) generate these output;

4 -> nodes=1:ppn=4
8 -> nodes=1:ppn=8
12 -> nodes=
2:ppn=6
13 -> nodes=2:ppn=7
16 -> nodes=2:ppn=8
18 -> nodes=3:ppn=6
23 -> nodes=3:ppn=8
24 -> nodes=3:ppn=8
32 -> nodes=4:ppn=8

In case of 12,13 and 18 way job, it does not requests full number of cores per node to minimized waste of unused cores. But, there is still sort of internal fragmentation in case of 13, which requests 14 cores even though it only needs 13 cores. In other words, requesting 13 cores are not really efficient at all.

Now it's time to install and test it.

Follow these steps to install tasklayout.m.

1. Define 'ResourceTemplate' in TORQUE Scheduler Configuration Properties

Click 'Parallel/Manage Configurations' on Matlab window.
Click 'File/Import' on 'Configurations Manager window'.
Double click configuration you want to modify.
Set 'ResourceTemplate' to '-l nodes=^N^,walltime=24:00:00'.
*Probably, most of you have done this already.

2. Copy tasklayout.m to Matlab directory.

cp tasklayout.m $MATLAB/toolbox/local


3. Modify $MATLAB/toolbox/distcomp/@distcomp/@pbsscheduler/pSubmitParallelJob.m. Assume each node has 8 cores.

selectStr=strrep(pbs.ResourceTemplate,'^N^',num2str(length(job.Tasks)))

to

selectStr=strrep(pbs.ResourceTemplate,'^N^',tasklayout(length(job.Tasks),8))

4. Done

Please, let me know if it is not compatible in certain environment or have bugs or anything is missing in this function.

Thanks




function taskStr = tasklayout( numTasks,numPpn )
%TASKLAYOUT Construct CPU requirement string for Torque Scheduler
% TASKLAYOUT(X,Y) construct CPU requirement string for X tasks
% with each node has Y cores.
%
% Notes:
%
% Matlab Distributed Computing Server directly supports Torque scheduler
% with minimum configuration. However, when it passes parameter such as
% number of CPU to Torque, it only allows passing one parameter using '^N^'
% keyword, which is defined in 'ResourceTempalte' at 'Scheduler
% Configuration Properties' window.
%
% Unfortunately, Torque, in general, needs two parameters in this format
% to submit multi nodes job.
%
% nodes=X:ppn=Y
%
% where X denotes number of node, Y denotes processor per node,
% respectively.
%
% TASKLAYOUT takes one parameter and claculates optimal way to define X, Y
% values and constructs right string which can be used by 'psub' command
% internally.
%
% Example 1:
% % Run 16 way job, each node has 8 cores.
% reqStr = tasklayout(16,8)
%
% ans =
%
% nodes=2:ppn=8
%
% returns
% taskStr
%
% See also matlabpool

% For Matlab Distributed Computing Server
% (c) Brian Kim @ Texas A&M University

if ( numTasks <= numPpn )
taskStr = strcat('1:ppn=',num2str(numTasks)) ;
elseif ( numTasks > numPpn )
if ( rem(numTasks,numPpn) == 0 )
taskStr = strcat(num2str(ceil(numTasks/numPpn)), ... ,
':ppn=',num2str(numPpn));
else
taskStr = strcat(num2str(ceil(numTasks/numPpn)),':ppn=', ... ,
num2str(ceil(numTasks/ceil(numTasks/numPpn))));
end
end


Thursday, May 13, 2010

Quick install guide for LAMMPS on Linux cluster

This is a quick installation guide for LAMMS 10 May 2010 version for Linux cluster and it can be done within 1 hours if you follow this carefully.

SYSTEM SPECIFICATION

Intel(R) Xeon(R) CPU X5560 @ 2.80GHz
Red Hat Enterprise Linux Server release 5.4 (Tikanga) 2.6.18-164.11.1.el5
Intel compiler and MPI stack
mpiicc for the Intel(R) MPI Library 4.0 for Linux*
Copyright(C) 2003-2010, Intel Corporation. All rights reserved.
Version 11.1

Prerequisites

Download these 2 files and untar them, respectively.

- fftw-2.1.5.tar.gz
http://www.fftw.org/fftw-2.1.5.tar.gz
- lammps.tar.gz (lib for LAMMPS, LAMMPS itself)
http://lammps.sandia.gov/download.html

Instruction

In a nutshell, installation procedure consists of 3 steps; (1)FFTW, (2)libs for LAMMPS, (3)LAMMPS itself. And if you use mpiicc and mpiifort, then you don't have to worry about the PATH of MPI package and it will be taken care of automatically.

(1)FFTW

Even though the latest version of FFTW is 3.2.2, but, unfortunately, LAMMS can not work with it. You better stick to 2.1.5 for now. And I assume you're installing it at /usr/local/fftw-2.1.5 directory.

After uncompressing it,

cd fftw-2.1.5
./configure CC=mpiicc F77=mpiifort --prefix=/usr/local/fftw-2.1.5
make
make check
make install

(2)libs for LAMMPS

After uncompressing lammps.tar.gz,(actually, libs for LAMMPS is part of lammps.tar.gz)

cd lib/reax
Change ifort to mpiifort in Makefile.ifort
make -f Makefile.ifort

cd lib/meam
Change ifort to mpiifort in Makefile.ifort
make -f Makefile.ifort

cd lib/poems
Change icc to mpiicc in Makefile.icc
make -f Makefile.icc

(3)LAMMPS
cd src

Check which packages are included
make package-status

Choose all standard packages to be included
make yes-standard

If you don't have GPU, then exclude gpu package. Otherwise, you will see tons of error message when you compile it.
make no-gpu

Edit MAKE/Makefile.linux

Remove MPI_PATH,MPI_LIB, it will be taken care of by mpiicc, mpiifort
#MPI_PATH =
#MPI_LIB = -lmpich -lpthread

CC=mpiicc
LINK=mpiicc
FFT_INC = -I/usr/local/fftw-2.1.5/include -DFFT_FFTW
FFT_PATH = -L/usr/local/fftw-2.1.5/lib
FFT_LIB = -lfftw

Build LAMMPS as an executable and library as well

make linux
make makelib
make -f Makefile.lib linux

INSTALLATION

I assume you're installing lammps at /usr/local/lammps directory.

copy bench/ doc/ examples/ potentials/ README tools/ to /usr/local/lammps
copy all *.a to /usr/local/lammps/lib
copy lmp_linux to /usr/local/lammps/bin

Done!!!

Once you have gotten this far, just let user know lammps is available at /usr/local/lammps, then they know how to play around it.

Tuesday, October 7, 2008

cluserssh : life saver for cluster system administrator

As an administrator of cluster system, I have to repeat same work on each node occasionally or very often. If cluster have some of useful software installed, specifically such as management tools or administration GUI or something, job can be done nicely and elegantly. Otherwise, it's disaster. Just imagine, typing bunch of same commands over and over again in each node.

Well, there is a life saver for these under budgeted cluster system administrator.

It is 'clusterssh'.

Few days ago, I had a job assigned and it was installing a new Matlab 2008a on 8 linux machines. It is not a cluster system though, but, what I have to do is basically install Matlab 2008a 8 times, which means I have to login each node and initiate installation procedure and type all the parameters in each step of installation process again and again.

I used 'clusterssh' instead of normal ssh and I saved a lot of time and typing same thing over and over.

It's never been easier. Just type this command in your xterm;

$cssh root@machine1 root@machine2 root@machine3 root@machine4 root@machine5

then, it magically fires up 5 xterm windows concurrently and one small 'command window'. Then, click that command window to put cursor focus on it, and type any command. Now real magic starts.

For example, if you type 'ls', then you will see that command is sent to each node, ran and showed the result.

It's kind like 'one shot, kills multiple birds'

So, what I did to install Matlab 2008a on 8 Linux machines was simply that;

(1) put Matlab dvd on machine 1
(2) export dvd through NFS
(3) cssh to 7 machines
(4) mount it using NFS
(5) go through Matlab installation only once
(6) Boom! It's done.