diff --git a/ex1/Makefile b/ex1/Makefile new file mode 100644 index 0000000..e41c65c --- /dev/null +++ b/ex1/Makefile @@ -0,0 +1,22 @@ +CC=gcc +CFLAGS = -g -O0 +LFLAGS = -g +LIBS= + + +.SUFFIXES: +.SUFFIXES: .o .c + +.c.o: + $(CC) $(CFLAGS) -c $< + +OBJS = hello.o output.o + +all: hello + +hello: $(OBJS) + $(CC) $(LDFLAGS) -o $@ $? $(LIBS) + +clean: + rm -f *.o hello hello_mpi + diff --git a/ex1/hello.c b/ex1/hello.c new file mode 100644 index 0000000..a40d87c --- /dev/null +++ b/ex1/hello.c @@ -0,0 +1,8 @@ +#include "output.h" + +int main(int argc, char* argv[]) +{ + print_hello_world_msg(); + return 0; +} + diff --git a/ex1/output.c b/ex1/output.c new file mode 100644 index 0000000..ef70701 --- /dev/null +++ b/ex1/output.c @@ -0,0 +1,6 @@ +#include + +extern void print_hello_world_msg() +{ + printf("Hello World!\n"); +} diff --git a/ex1/output.h b/ex1/output.h new file mode 100644 index 0000000..f35ed37 --- /dev/null +++ b/ex1/output.h @@ -0,0 +1,2 @@ + +extern void print_hello_world_msg(); diff --git a/ex2/build_run.sh b/ex2/build_run.sh new file mode 100755 index 0000000..d02dfd5 --- /dev/null +++ b/ex2/build_run.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +if [ $SHELL == "/bin/tcsh" ]; then + source /etc/profile.d/modules.sh +fi +module purge +echo module load intel intelmpi +module load intel intelmpi + +echo mpiicc -o hello_mpi hello_mpi.c +mpiicc -g -o hello_mpi hello_mpi.c + +echo srun -N2 -n2 --partition=debug ./hello_mpi +srun -N2 -n2 --partition=debug ./hello_mpi diff --git a/ex2/hello_mpi.c b/ex2/hello_mpi.c new file mode 100644 index 0000000..21c267c --- /dev/null +++ b/ex2/hello_mpi.c @@ -0,0 +1,24 @@ +#include +#include + +int main(int argc, char* argv[]) +{ + int size, rank, resultlen; + char name[MPI_MAX_PROCESSOR_NAME]; + + /* Initialize MPI */ + MPI_Init(&argc, &argv); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &size); + MPI_Get_processor_name(name, &resultlen); + + /* printf("Hello world, I am rank %d of size %d\n", rank, size); */ + printf("Hello world: I am task rank %d, running on node '%s'\n", rank, name); + + /* Synchronize MPI processes */ + MPI_Barrier(MPI_COMM_WORLD); + + MPI_Finalize(); + return 0; +} + diff --git a/ex3/build-octopus-par.sh b/ex3/build-octopus-par.sh new file mode 100755 index 0000000..d53ee3e --- /dev/null +++ b/ex3/build-octopus-par.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# Build octopus (www.tddft.org) for sequential only (no OMP, no MPI) package + +if [ $SHELL == "/bin/tcsh" ]; then + source /etc/profile.d/modules.sh +fi +module purge +module load intel/15.0.0 intelmpi/5.0.1 fftw/3.3.4/intel-15.0.0 gsl/1.16/intel-15.0.0 + +# prefix location +mkdir install +INSTALL=$(pwd)/install + +# build libxc first +wget 'http://www.tddft.org/programs/octopus/down.php?file=libxc/libxc-2.0.0.tar.gz' -O libxc-2.0.0.tar.gz +tar xzvf libxc-2.0.0.tar.gz +cd libxc-2.0.0 +./configure --prefix=$INSTALL CC=icc CFLAGS="-O2 -ip -ftz" FC=ifort FCFLAGS="-O2 -ip -ftz" +if [ $? -eq 0 ]; then + make -j4 + if [ $? -eq 0 ]; then + make install + fi +fi +cd .. + +# build octopus +wget 'http://www.tddft.org/programs/octopus/down.php?file=4.1.2/octopus-4.1.2.tar.gz' -O octopus-4.1.2.tar.gz +tar xzvf octopus-4.1.2.tar.gz +cd octopus-4.1.2 + +./configure --prefix=$INSTALL \ +--enable-openmp --enable-mpi \ +--with-libxc-prefix=$INSTALL \ +--with-gsl-prefix=${GSL_ROOT} \ +--disable-zdotc-test \ +--with-blas="-L${MKL_ROOT}/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -lpthread -lm" \ +--with-fft-lib="-L${FFTW_LIBRARY} -lfftw3 -lfftw3_threads" \ +CC=mpiicc CFLAGS="-O2 -ip -ftz -openmp" \ +FC=mpiifort FCFLAGS="-O2 -ip -ftz -openmp" +if [ $? -eq 0 ]; then + make -j4 + if [ $? -eq 0 ]; then + make install + # make check + fi +fi + diff --git a/ex3/build-octopus-seq.sh b/ex3/build-octopus-seq.sh new file mode 100755 index 0000000..f595352 --- /dev/null +++ b/ex3/build-octopus-seq.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# Build octopus (www.tddft.org) for sequential only (no OMP, no MPI) package + +if [ $SHELL == "/bin/tcsh" ]; then + source /etc/profile.d/modules.sh +fi +module purge +module load intel/15.0.0 fftw/3.3.4/intel-15.0.0 gsl/1.16/intel-15.0.0 + +# prefix location +mkdir install +INSTALL=$(pwd)/install + +# build libxc first +wget 'http://www.tddft.org/programs/octopus/down.php?file=libxc/libxc-2.0.0.tar.gz' -O libxc-2.0.0.tar.gz +tar xzvf libxc-2.0.0.tar.gz +cd libxc-2.0.0 +./configure --prefix=$INSTALL CC=icc CFLAGS="-O2 -ip -ftz" FC=ifort FCFLAGS="-O2 -ip -ftz" +if [ $? -eq 0 ]; then + make -j4 + if [ $? -eq 0 ]; then + make install + fi +fi +cd .. + +# build octopus +wget 'http://www.tddft.org/programs/octopus/down.php?file=4.1.2/octopus-4.1.2.tar.gz' -O octopus-4.1.2.tar.gz +tar xzvf octopus-4.1.2.tar.gz +cd octopus-4.1.2 + +./configure --prefix=$INSTALL \ +--with-libxc-prefix=$INSTALL \ +--with-gsl-prefix=${GSL_ROOT} \ +--disable-zdotc-test \ +--with-blas="-L${MKL_ROOT}/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread -lm" \ +--with-fft-lib="-L${FFTW_LIBRARY} -lfftw3 -lfftw3_threads" \ +CC=icc CFLAGS="-O2 -ip -ftz" \ +FC=ifort FCFLAGS="-O2 -ip -ftz" +if [ $? -eq 0 ]; then + make -j4 + if [ $? -eq 0 ]; then + make install + make check + fi +fi + diff --git a/ex3/clean.sh b/ex3/clean.sh new file mode 100755 index 0000000..7351845 --- /dev/null +++ b/ex3/clean.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +rm -f libxc-2.0.0.tar.gz octopus-4.1.2.tar.gz +rm -rf octopus-4.1.2 libxc-2.0.0 install + diff --git a/ex3/test-octopus/inp b/ex3/test-octopus/inp new file mode 100644 index 0000000..dba15ab --- /dev/null +++ b/ex3/test-octopus/inp @@ -0,0 +1,5 @@ +CalculationMode = gs + +%Coordinates + 'H' | 0 | 0 | 0 +% diff --git a/ex3/test-octopus/slurm.job b/ex3/test-octopus/slurm.job new file mode 100644 index 0000000..f361dc2 --- /dev/null +++ b/ex3/test-octopus/slurm.job @@ -0,0 +1,12 @@ +#!/bin/bash +#SBATCH --nodes 1 +#SBATCH --ntasks 2 +#SBATCH --cpus-per-task 8 +#SBATCH --mem 32000 +#SBATCH --time 01:00:00 + +export OMP_NUM_THREADS=8 +source /etc/profile.d/modules.sh +module purge +module load intel intelmpi +srun ../install/bin/octopus_mpi