Last active
April 26, 2016 22:42
-
-
Save dyndna/78d60651c3e3327e7d809ce32c5f49b7 to your computer and use it in GitHub Desktop.
Makefile for mpibzip2: How to compile on cluster machine running Cent OS 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### Parallel MPI BZIP2 | |
## See man doc at http://compression.ca/mpibzip2/ | |
### for .tar or tar.bz2 files, | |
## mpirun -np 4 mpibzip2 myfile.tar or mpirun -np 4 mpibzip2 myfile.tar.bz2 | |
### for tar.gz files, see pigz at http://serverfault.com/a/270825/149084 | |
## pigz -dk -p 4 target.tar.gz | tar -xf | |
# remove -k to delete original file after decompression. | |
# Make file for MPI BZIP2 | |
SHELL=/bin/sh | |
# Compiler to use | |
# You may need to change CC to something like CC=mpiCC | |
## For nautilus HPC, first do: | |
## module load zlib and openmpi | |
## extract mpibzip2 and cd mpibzip2-0.6 | |
## install libbzip2: see README of mpibzip2 on how to compile bzip2-1.0.6, and put two compiled files, libbz2.a and bzlib.h in mpibzip2 directory. | |
## module show openmpi and get path to libmpi.so file as well as lib64 and include directory. Symlink libmpi.so to mpibzip2-0.6 base directory. | |
## ln -s /usr/mpi/gcc/openmpi-1.8.4/lib64/libmpi.so ./ | |
## Use either standard make command or static version install below. | |
## IMPORTANT: change compiler to mpic++ | |
CC=mpic++ | |
# Where you want mpibzip2 installed when you do 'make install' | |
PREFIX=/usr | |
all: mpibzip2 | |
# Standard mpibzip2 compile | |
mpibzip2: mpibzip2.cpp | |
$(CC) -O2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o mpibzip2 mpibzip2.cpp -lbz2 -lmpi -lpthread | |
## Choose this if you want to compile in a static version of the libbz2 library | |
## change -L and -I flags to corresponding openmpi lib64 and include directory paths and remove -lmpi. Also, use additonal -L. flag to source local directory for copied libbz2.a and bzlib.h files from libbzip2 compiled library. | |
## now run make mpibzip2-static and mpibzip2 should be compiled. | |
mpibzip2-static: libbz2.a mpibzip2.cpp | |
$(CC) -O2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o mpibzip2 mpibzip2.cpp -L/usr/mpi/gcc/openmpi-1.8.4/lib64 -lpthread -I/usr/mpi/gcc/openmpi-1.8.4/include -L. -lbz2 | |
## Original command: | |
# mpibzip2-static: libbz2.a mpibzip2.cpp | |
# $(CC) -O2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o mpibzip2 mpibzip2.cpp -lmpi -lpthread -I. -L. -lbz2 | |
# Compatability mode for 32bit file sizes (less than 2GB) and systems | |
# that have compilers that treat int as 64bit natively | |
mpibzip2-compat: mpibzip2.cpp | |
$(CC) -O2 -o mpibzip2 mpibzip2.cpp -lbz2 -lmpi -lpthread | |
# Compile for Sun/Solaris MPI | |
sun: mpibzip2.cpp | |
mpCC -O3 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o mpibzip2 mpibzip2.cpp -pthread -lpthread -lmpi_mt -lbz2 | |
# Install the binary pbzip2 program and man page | |
install: mpibzip2 | |
if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi | |
if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi | |
if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi | |
cp -f mpibzip2 $(PREFIX)/bin/mpibzip2 | |
chmod a+x $(PREFIX)/bin/mpibzip2 | |
cp -f mpibzip2.1 $(PREFIX)/man/man1 | |
chmod a+r $(PREFIX)/man/man1/mpibzip2.1 | |
clean: | |
rm mpibzip2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment