Presentation is loading. Please wait.

Presentation is loading. Please wait.

Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Kickstart Tutorial/Seminar on using the 64-nodes P4-Xeon Cluster in Science Faculty June 11, 2003.

Similar presentations


Presentation on theme: "Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Kickstart Tutorial/Seminar on using the 64-nodes P4-Xeon Cluster in Science Faculty June 11, 2003."— Presentation transcript:

1 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Kickstart Tutorial/Seminar on using the 64-nodes P4-Xeon Cluster in Science Faculty June 11, 2003

2 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Aims and target audience Aims: –Provide a kickstart tutorial to potential cluster users in Science Faculty, HKBU –Promote the usage of the PC cluster in Science Faculty Target audience –Science Faculty students referred by their project/thesis supervisors –Staff who are interested in High Performance Computing

3 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Outline Brief introduction –Hardware, software, login and policy How to write and run program on multiple CPUs –Simple MPI programming –Resources on MPI documentation Demonstration of software installed –SPRNG, BLAS, NAMD2, GAMESS, PGI

4 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Bought by Teaching Development Grant

5 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Hardware Configuration 1 master node + 64 compute nodes + Gigabit Interconnection Master node –Dell PE2650, P4-Xeon 2.8GHz x 2 –4GB RAM, 36GB x 2 U160 SCSI (mirror) –Gigabit ethernet ports x 2 SCSI attached storage –Dell PV220S –73GB x 10 (RAID5)

6 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Hardware Configuration (cont) Compute nodes –Dell PE2650, P4-Xeon 2.8GHz x 2 –2GB RAM, 36GB U160 SCSI HD –Gigabit ethernet ports x 2 Gigabit Interconnect –Extreme Blackdiamond 6816 Gigabit ethernet –256Gb backplane –72 Gigabit ports (8 ports card x 9)

7 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Software installed Cluster operating system –ROCKS from MPI and PVM libraries –LAM/MPI 6.5.9, MPICH 1.2.5, PVM beolin Compilers –GCC 2.96, GCC –PGI C/C++/f77/f90/hpf version 4.0 MATH libraries –ATLAS 3.4.1, ScaLAPACK, SPRNG 2.0a Application software –MATLAB 6.1 with MPITB –Gromacs 3.1.4, NAMD2.5b1, Gamess Editors –vi, pico, emacs, joe Queuing system –OpenPBS , Maui scheduler

8 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Cluster O.S. – ROCKS Developed by NPACI and SDSC Based on RedHat 7.3 Allow setup of 64 nodes in 1 hour Useful command for users to monitor jobs in all nodes. E.g. –cluster-fork date –cluster-ps morris –cluster-kill morris Web based management and monitoring –http://tdgrocks.sci.hkbu.edu.hk

9 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Ganglia

10 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU PBS Job queue

11 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Hostnames Master node –External : tdgrocks.sci.hkbu.edu.hk –Internal : frontend-0 Compute nodes –comp-pvfs-0-1, …, comp-pvfs-0-48 –Short names: cp0-1, cp0-2, …, cp0-48

12 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Network diagram Master node Compute node Gigibit ethernet switch tdgrocks.sci.hkbu.edu.hk frontend-0 ( ) comp-pvfs-0-1 ( ) comp-pvfs-0-2 ( ) comp-pvfs-0-48 ( )

13 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Login to the master node Login is allowed remotely in all HKBU networked PCs by ssh or vncviewer SSH Login (terminal login) –Using your favourite ssh client software, namely putty, SSHsecureshell on windows and openssh on Linux/UNIXputtySSHsecureshell openssh –E.g. on all SCI workstations (sc11 – sc30), type ssh tdgrocks.sci.hkbu.edu.hk

14 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Login to the master node VNC Login (graphical login) –Using vncviewer download from –E.g. in sc11 – sc30.sci.hkbu.edu.hk, vncviewer vnc.sci.hkbu.edu.hk:51 –E.g. in windows, run vncviewer and upon asking the server address, type vnc.sci.hkbu.edu.hk:51

15 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Username and password The unified password authentication has been implemented Same as that of your netware account Password authentication using NDS-AS Setup similar to net1 and net4 in ITSC

16 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU ssh key generation To make use of multiple nodes in the PC cluster, users are restricted to use ssh. Key generation is done once automatically during first login You may input a passphrase to protect the key pair The key pair is stored in your $HOME/.ssh/

17 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU User Policy Users are allowed to remote login from other networked PCs in HKBU. All users must use their own user account to login. The master node (frontend) is used only for login, simple editing of program source code, preparing the job dispatching script and dispatching of jobs to compute node. No foreground or background can be run on it. Dispatching of jobs must be done via the OpenPBS system.

18 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU OpenPBS system Provide a fair and efficient job dispatching and queuing system to the cluster PBS script shall be written for running job Either sequential or parallel jobs can be handled by PBS Jobs error and output are stored in different filenames according to job IDs.

19 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU PBS script example (sequential) PBS scripts are shell script with directives preceding with #PBS The above example request only 1 node and deliver the job named ‘prime’ in default queue. The PBS system will mail a message after the job executed. #!/bin/bash #PBS -l nodes=1 #PBS -N prime #PBS -m ae #PBS -q default # the above is the PBS directive used in batch queue # Assume that you placed the executable in /u1/local/share/pbsexamples echo Running on host `hostname` /u1/local/share/pbsexamples/prime

20 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Delivering PBS job Prepare and compile executable cp /u1/local/share/pbsexamples/prime.c. cc –o prime prime.c -lm Prepare and edit PBS script as previous cp /u1/local/share/pbsexamples/prime.bat. Submit the job qsub prime.bat

21 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU PBS script example (parallel) #!/bin/sh #PBS -N cpi #PBS -r n #PBS -e cpi.err #PBS -o cpi.log #PBS -m ae #PBS -l nodes=5:ppn=2 #PBS -l walltime=01:00:00 # This job's working directory echo Working directory is $PBS_O_WORKDIR cd $PBS_O_WORKDIR echo Running on host `hostname` echo This jobs runs on the following processors: echo `cat $PBS_NODEFILE` # Define number of processors NPROCS=`wc -l < $PBS_NODEFILE` echo This job has allocated $NPROCS nodes # Run the parallel MPI executable “cpi” /u1/local/mpich-1.2.5/bin/mpirun -v -machinefile $PBS_NODEFILE -np $NPROCS /u1/local/share/pbsexamples/cpi

22 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Delivering parallel jobs Copy the PBS script examples cp /u1/local/share/pbsexamples/runcpi. Submit the PBS job qsub runcpi Note the error and output files named cpi.e??? and cpi.o???

23 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU End of Part 1 Thank you!

24 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Demonstration of software installed SPRNG BLAS, ScaLAPACK MPITB for MATLAB NAMD2 and VMD GAMESS, GROMACS PGI Compilers for parallel programming More…

25 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU SPRNG 2.0a Scalable Parallel Pseudo Random Number Generators Library A set of libraries for scalable and portable pseudorandom number generation. Most suitable for parallel Monte-Carlo simulation The current version is installed in /u1/local/sprng2.0a For serial source code (e.g. mcErf.c), compile with gcc -c -I /u1/local/sprng2.0/include mcErf.c gcc -o mcErf -L /u1/local/sprng2.0/lib mcErf.o -lsprng –lm For parallel source code (e.g. mcErf-mpi.c, compile with mpicc -c -I /u1/local/sprng2.0/include mcErf-mpi.c mpicc -o mcErf-mpi -L /u1/local/sprng2.0/lib mcErf-mpi.o \ -lsprng –lpmpich –lmpich –lm Or use Makefile to automate the above process Samples file mcPi.tar.gz, mcErf.tar.gz can be found in /u1/local/share/example/sprng/ in the cluster Thanks for Mr. K.I. Liu for providing documentations and samples for SPRNG in More information can be found in

26 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU BLAS Basic Linear Algebra Subprograms basic vector and matrix operations Sample code showing the speed of BLAS matrix- matrix multiplication against self written for loop in /u1/local/share/example/blas –dgemm.c, makefile.dgemm.c, –dgemm-mpi.c, makefile.dgemm-mpi Thanks Mr. C.W. Yeung, MATH for providing the above example Further information can be found in

27 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU ScaLAPACK Scalable LAPACK PBLAS + BLACS PBLAS : Parallel Basic Linear Algebra Subprograms BLACS : Basic Linear Algebra Communication Subprograms Support MPI and PVM Only MPI version can be found in our cluster Directories for BLAS, BLACS and ScaLAPACK libraries: –/u1/local/ATLAS/lib/Linux_P4SSE2_2/ –/u1/local/BLACS/LIBS –/u1/local/SCALAPACK/libscalapack.a PBLAS and ScaLAPACK examples (pblas.tgz, scaex.tgz) are stored in /u1/local/share/example/scalapack Further information for ScaLAPACK can be found in Please ask Morris for further information.

28 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU MPITB for MATLAB MPITB example –MC.tar.gz in /u1/local/share/example/mpitb Untar the example in your home tar xzvf /u1/local/share/example/mpitb/MC.tar.gz Lamboot first then start matlab and run qsub runMCpbs.bat Further information can be found in –http://www.sci.hkbu.edu.hk/~smlam/tdgc/MPITBhttp://www.sci.hkbu.edu.hk/~smlam/tdgc/MPITB –Thanks Tammy Lam, MATH for providing the above homepage and examples

29 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU NAMD2 parallel, object oriented molecular dynamics code high-performance simulation of large biomolecular systems binary downloaded and installed in /u1/local/namd2/ work with VMD frontend (GUI) Demonstration of VMD and NAMD using alanin.zip in /u1/local/example/namd2 Further information can be found in Ask Morris Law for further information

30 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU

31 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU GAMESS The General Atomic and Molecular Electronic Structure System A general ab initio quantum chemistry package Thanks for Justin Lau, CHEM for providing sample scripts and explanation of the Chemistry behind.

32 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU PGI compilers support 3 types of parallel programming 1.Automatic shared-memory parallel –Use in SMP within the same node (max NCPUS=2) –Using the option -Mconcur in pgcc, pgCC, pgf77, pgf90 pgcc –o pgprime –Mconcur prime.c export NCPUS=2./pgprime 2.User-directed shared-memory parallel –Use in SMP within the same node (max NCPUS=2) –Using the option -mp in pgcc, pgCC, pgf77, pgf90 pgf90 –o f90prime –Mconcur prime.f90 export NCPUS=2./f90prime –User should understand OpenMP parallelization directives for Fortran and pragmas for C and C++ –Consult PGI Workstations user guide for details

33 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU PGI compilers support 3 types of parallel programming 3.Data parallel shared- or distribute-memory parallel –Only HPF support –suitable in SMP and cluster environment pghpf –o hello hello.hpf./hello –pghpf –np 8 –stat alls –PGHPF environmental variables PGHPF_RSH=ssh PGHPF_HOST=cp0-1,cp0-2, PGHPF_STAT=alls (can be cpu, mem, all, etc) PGHPF_NP (max no.=16, license limit) –Example files in /u1/local/share/example/hpf hello.tar.gz, pde1.tar.gz –Consult PGHPF user guide in

34 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Other software in considerations PGAPACK –Parallel Genetic Algorithm Package –/u1/local/pga PETSc –the Portable, Extensible Toolkit for Scientific computation Any suggestions

35 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU End of Part 2 Thank you!

36 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU What is Message Passing Interface (MPI)? Portable standard for communication Processes can communicate through messages. Each process is a separable program All data is private

37 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU What is Message Passing Interface (MPI)? This is a library, not a language!! Different compilers, but all must use the same libraries, i.e. MPICH, LAM, etc. There are two versions now, MPI-1 and MPI-2 Use standard sequential language. Fortran, C, etc.

38 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Basic Idea of Message Passing Interface (MPI) MPI Environment - Initialize, manage, and terminate communication among processes Communication between processes –global communication, i.e. broadcast, gather, etc. –point to point communication, i.e. send, receive, etc. Complicated data structures –i.e. matrices and memory

39 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Is MPI Large or Small? MPI is large –More than one hundred functions –But not necessarily a measure of complexity MPI is small –Many parallel programs can be written with just 6 basic functions MPI is just right –One can access flexibility when it is required –One need not master all MPI functions

40 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU When Use MPI? You need a portable parallel program You are writing a parallel library You care about performance You have a problem that can be solved in parallel ways

41 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU F77/F90, C/C++ MPI library calls Fortran 77/90 uses subroutines –CALL is used to invoke the library call –Nothing is returned, the error code variable is the last argument –All variables are passed by reference C/C++ uses functions –Just the name is used to invoke the library call –The function returns an integer value (an error code) –Variables are passed by value, unless otherwise specified

42 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Getting started with LAM Create a file called “lamhosts” The content of “lamhosts” (8 notes): cp0-1 cp0-2 cp0-3 … cp0-8 frontend-0

43 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Getting started with LAM starts LAM on the specified cluster LAMRSH=ssh export LAMRSH lamboot -v lamhosts removes all traces of the LAM session on the network lamhalt In the case of a catastrophic failure (e.g., one or more LAM nodes crash), the lamhalt utility will hang LAMRSH=ssh export LAMRSH wipe -v lamhosts

44 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Getting started with MPICH Open the “.bashrc” under your home directory Add a path at the end of the file: PATH=/u1/local/mpich /bin:/u1/local/pgi/linux86/bin:$PATH Save and exit Restart the terminal

45 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU MPI Commands mpicc - compiles an mpi program mpicc -o foo foo.c mpif77 -o foo foo.f mpif90 -o foo foo.f90 mpirun - start the execution of mpi programs mpirun -v -np 2 foo

46 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU MPI Environment Initialize - initialize environment Finalize - terminate environment Communicator- create default comm. group for all processes Version - establish version of MPI Total processes - spawn total processes Rank/Process ID - assign identifier to each process Timing Functions - MPI_Wtime, MPI_Wtick

47 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU MPI_INIT Initializes the MPI environment Assigns all spawned processes to MPI_COMM_WORLD, default comm. C –int MPI_Init(argc,argv) int *argc; char ***argv; –INPUT PARAMETERS argc - Pointer to the number of arguments argv - Pointer to the argument vector Fortran –CALL MPI_INIT(error_code) –int error_code – variable that gets set to an error code

48 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU MPI_FINALIZE Terminates the MPI environment C –int MPI_Finalize() Fortran –CALL MPI_FINALIZE(error_code) –int error_code – variable that gets set to an error code

49 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Hello World 1 (C) #include int main(int argc, char *argv[]) { MPI_Init(&argc, &argv); printf(”Hello world!\n”); MPI_Finalize(); return(0); }

50 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Hello World 1 (Fortran) program main include 'mpif.h' integer ierr call MPI_INIT(ierr) print *, 'Hello world!' call MPI_FINALIZE(ierr) end

51 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU MPI_COMM_SIZE This finds the number of processes in a communication group C –int MPI_Comm_size ( comm, size ) MPI_Comm comm – MPI communication group; int *size; –INPUT PARAMETER comm - communicator (handle) –OUTPUT PARAMETER size - number of processes in the group of comm (integer) Fortran –CALL MPI_COMM_SIZE(comm, size, error_code) –int error_code – variable that gets set to an error code Using MPI_COMM_WORLD will return the total number of processes started

52 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU MPI_COMM_RANK This gives the rank/identification number of a process in a communication group C –int MPI_Comm_rank ( comm, rank ) MPI_Comm comm; int *rank; –INPUT PARAMETERS comm - communicator (handle) –OUTPUT PARAMETER rank – rank/id number of the process who made the call (integer) Fortran –CALL MPI_COMM_RANK(comm, rank, error_code) –int error_code – variable that gets set to an error code Using MPI_COMM_WORLD will return the rank of the process in relation to all processes that were started

53 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Hello World 2 (C) #include int main(int argc, char *argv[]) { int rank, size; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &size); printf(”Hello world! I am %d of %d\n”, rank, size); MPI_Finalize(); return(0); }

54 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Hello World 2 (Fortran) program main include 'mpif.h' integer rank, size, ierr call MPI_INIT(ierr) call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr) call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierr) print *, 'Hello world! I am ', rank, ' of ', size call MPI_FINALIZE(ierr) end

55 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU MPI_Send standard send C –int MPI_Send( buf, count, datatype, dest, tag, comm ) void *buf; int count, dest, tag; MPI_Datatype datatype; MPI_Comm comm; –INPUT PARAMETERS buf initial address of send buffer (choice) count number of elements in send buffer (non negative integer) datatype datatype of each send buffer element (handle) dest rank of destination (integer) tag message tag (integer) comm communicator (handle) –NOTES This routine may block until the message is received.

56 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU MPI_Send Fortran –MPI_SEND(BUF, COUNT, DATATYPE, DEST, TAG, COM, IERR)

57 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU MPI_Recv basic receive C –int MPI_Recv( buf, count, datatype, source, tag, comm, status ) void *buf; int count, source, tag; MPI_Datatype datatype; MPI_Comm comm; MPI_Status *status; –OUTPUT PARAMETERS buf initial address of receive buffer (choice) status status object (Status) –INPUT PARAMETERS count maximum number of elements in receive buffer (integer) datatype datatype of each receive buffer element (handle) source rank of source (integer) tag message tag (integer) comm communicator (handle)

58 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU MPI_Recv Fortran –MPI_RECV(BUF, COUNT, DATATYPE, SOURCE, TAG, COMM, STATUS, IERR)

59 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Timing Functions MPI_Wtime() - returns a floating point number of seconds, representing elapsed wall-clock time. MPI_Wtick() - returns a double precision number of seconds between successive clock ticks. ** The times returned are local to the node/processor that made the call.

60 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Hello World 3 (C) /* * The root node sends out a message to the next node in the ring and each node then passes the * message along to the next node. The root node times how long it takes for the message to get back to it. */ #include /* for input/output */ #include /* for mpi routines */ #define BUFSIZE 64 /* The size of the messege being passed */ main( int argc, char** argv) { double start,finish; int my_rank; /* the rank of this process */ int n_processes; /* the total number of processes */ char buf[BUFSIZE]; /* a buffer for the messege */ int tag=0; /* not important here */ float totalTime=0; /* for timing information */ MPI_Status status; /* not important here */ MPI_Init(&argc, &argv); /* Initializing mpi */ MPI_Comm_size(MPI_COMM_WORLD, &n_processes); /* Getting # of processes */ MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); /* Getting my rank */

61 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Hello World 3 (C) /* * If this process is the root process send a messege to the next node * and wait to recieve one from the last node. Time how long it takes * for the messege to get around the ring. If this process is not the * root node, wait to recieve a messege from the previous node and * then send it to the next node. */ start=MPI_Wtime(); printf("Hello world! I am %d of %d\n", my_rank, n_processes); if( my_rank == 0 ) { /* send to the next node */ MPI_Send(buf, BUFSIZE, MPI_CHAR, my_rank+1, tag, MPI_COMM_WORLD); /* recieve from the last node */ MPI_Recv(buf, BUFSIZE, MPI_CHAR, n_processes-1, tag, MPI_COMM_WORLD, &status); }

62 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Hello World 3 (C) if( my_rank != 0) { /* recieve from the previous node */ MPI_Recv(buf, BUFSIZE, MPI_CHAR, my_rank-1, tag, MPI_COMM_WORLD, &status); /* send to the next node */ MPI_Send(buf, BUFSIZE, MPI_CHAR, (my_rank+1)%n_processes, tag, MPI_COMM_WORLD); } finish=MPI_Wtime(); MPI_Finalize(); /* I'm done with mpi stuff */ /* Print out the results. */ if (my_rank == 0) printf("Total time used was %f seconds\n", finish-start); return 0; }

63 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Hello World 3 (Fortran) C/* C * The root node sends out a message to the next node in the ring and each node then passes the C * message along to the next node. The root node times how long it takes for the message to get back to it. C */ program main include 'mpif.h' double precision start, finish double precision buf(64) integer my_rank integer n_processes integer ierr integer BUFSIZE = 64 integer tag = 2001 call MPI_INIT(ierr) call MPI_COMM_RANK(MPI_COMM_WORLD, my_rank, ierr) call MPI_COMM_SIZE(MPI_COMM_WORLD, n_processes, ierr)

64 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Hello World 3 (Fortran) C/* C* If this process is the root process send a messege to the next node C* and wait to recieve one from the last node. Time how long it takes C* for the messege to get around the ring. If this process is not the C* root node, wait to recieve a messege from the previous node and C* then send it to the next node. C*/ start = MPI_Wtime() print *, 'Hello world! I am ', my_rank, ' of ', n_processes if (my_rank.eq. 0) then C/* send to the next node */ call MPI_SEND(buf, BUFSIZE, MPI_DOUBLE_PRECISION, my_rank+1, 1tag, MPI_COMM_WORLD, ierr) C/* recieve from the last node */ call MPI_RECV(buf, BUFSIZE, MPI_DOUBLE_PRECISION, n_processes-1, 1tag, MPI_COMM_WORLD, status, ierr) else

65 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Hello World 3 (Fortran) C/* recieve from the previous node */ call MPI_RECV(buf, BUFSIZE, MPI_DOUBLE_PRECISION, my_rank-1, tag, 1MPI_COMM_WORLD, status, ierr) C/* send to the next node */ call MPI_SEND(buf, BUFSIZE, MPI_DOUBLE_PRECISION, modulo 1((my_rank+1), n_processes), tag, MPI_COMM_WORLD, ierr) endif finish=MPI_Wtime() C/* Print out the results. */ if (my_rank.eq. 0) then print *, 'Total time used was ', finish-start, ' seconds' endif call MPI_FINALIZE(ierr) end

66 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU MPI C Datatypes MPI DatatypeC Datatype MPI_CHARsigned char MPI_SHORTsigned short int MPI_INTsigned int MPI_LONGsigned long int MPI_UNSIGNED_CHARunsigned char MPI_UNSIGNED_SHORTunsigned short int

67 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU MPI C Datatypes MPI DatatypeC Datatype MPI_UNSIGNEDunsigned int MPI_UNSIGNED_LONGunsigned long int MPI_FLOATfloat MPI_DOUBLEdouble MPI_LONG_DOUBLElong double MPI_BYTE MPI_PACKED

68 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU MPI Fortran Datatypes MPI DatatypeFortran Datatype MPI_INTEGERINTEGER MPI_REALREAL MPI_DOUBLE_PRECISIONDOUBLE PRECISION MPI_COMPLEXCOMPLEX MPI_LOGICALLOGICAL MPI_CHARACTERCHARACTER MPI_BYTE MPI_PACKED

69 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU End of Part 3 Thank You!

70 Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Thanks very much!


Download ppt "Using the P4-Xeon cluster HPCCC, Science Faculty, HKBU Kickstart Tutorial/Seminar on using the 64-nodes P4-Xeon Cluster in Science Faculty June 11, 2003."

Similar presentations


Ads by Google