This is not a blog, but my notes and tips for research. Feel free to take any information and leave any comments or questions.
Search This Blog
Showing posts with label Linux and Computing. Show all posts
Showing posts with label Linux and Computing. Show all posts
Tuesday, May 6, 2014
Compiliing openmpi using Intel compiler
# Download the source code from http://www.open-mpi.org/software/
# configuring
./configure --prefix=/opt/openmpi-1.8.1-Intel CC=icc CXX=icpc F77=ifort FC=ifort
# parallel make using 4 cores
make -j 4 all
# installation with sudo permission
sudo bash
make install
# "sudo make install" does not work due to environment settings.
Other source: https://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-open-mpi-with-the-intel-compilers
Installation/Linux/OpenFOAM-2.3.0/Ubuntu
sudo apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev \
gnuplot libreadline-dev libncurses-dev libxt-dev libopenmpi-dev openmpi-bin \
libboost-system-dev libboost-thread-dev libgmp-dev libmpfr-dev
cd ~ mkdir OpenFOAM cd OpenFOAM wget "http://downloads.sourceforge.net/foam/OpenFOAM-2.3.0.tgz?use_mirror=mesh" -O OpenFOAM-2.3.0.tgz wget "http://downloads.sourceforge.net/foam/ThirdParty-2.3.0.tgz?use_mirror=mesh" -O ThirdParty-2.3.0.tgz tar -xzf OpenFOAM-2.3.0.tgz tar -xzf ThirdParty-2.3.0.tgz
source $HOME/OpenFOAM/OpenFOAM-2.3.0/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI
echo "alias of230='source \$HOME/OpenFOAM/OpenFOAM-2.3.0/etc/bashrc $FOAM_SETTINGS'" \
>> $HOME/.bashrc
source $HOME/.bashrc
of230
cd $WM_THIRD_PARTY_DIR # This next command will take a while... somewhere between 5 minutes to 30 minutes. ./Allwmake > make.log 2>&1 #update the shell environment wmSET $FOAM_SETTINGS
#Go into OpenFOAM's main source folder cd $WM_PROJECT_DIR # This next command will take a while... somewhere between 30 minutes to 3-6 hours. ./Allwmake > make.log 2>&1 #Run it a second time for getting a summary of the installation ./Allwmake > make.log 2>&1
cd $WM_THIRD_PARTY_DIR ./makeParaView4 -qmake $(which qmake-qt4) cd $FOAM_UTILITIES/postProcessing/graphics/PV4Readers wmSET $FOAM_SETTINGS ./Allwclean ./Allwmake
http://openfoamwiki.net/index.php/Installation/Linux/OpenFOAM-2.3.0/Ubuntu#Ubuntu_14.04
Friday, March 21, 2014
Cross compiling between FORTRAN and C to use memset.
Makefile
===
FC=ifort
CC=icc
foo: mainf.o fmemset.o
$(FC) mainf.o fmemset.o -o foo
mainf.o: mainf.f90
$(FC) -c mainf.f90 -o mainf.o
fmemset.o: fmemset.c
$(CC) -c fmemset.c -o fmemset.o
run:
./foo
clean:
/bin/rm -f *.o ./foo
===
FORTRAN code: mainf.f90
===
program Albert
integer :: x,y
real :: a(4,4)
do 20 i=1,4
do 10 j=1,4
a(i,j) = 4
write (*,*) a(i,j)
10 continue
20 continue
! zeroing out 4*4 elements, each of 4 bytes
call fmemset(a,4*4*4)
write (*,*) "UPDATED ARRAY:"
do 40 i=1,4
do 30 j=1,4
write (*,*) a(i,j)
30 continue
40 continue
write(*,*) size(a)
end program Albert
===
C code: fmemset.c
===
#include
void fmemset_(void *a, int *n) {
memset(a,0,*n);
}
===
Developed by Prof. Henri Casanova at UHM. Thanks!
Friday, May 24, 2013
shell script with options
http://www.mkssoftware.com/docs/man1/getopts.1.asp
EXAMPLE
This is an example of using getopts in a shell script. Compare it to the getopt example.
# Example illustrating use of getopts builtin. This
# shell script would implement the paste command,
# using getopts to process options, if the underlying
# functionality was embedded in hypothetical utilities
# hpaste and vpaste, which perform horizontal and
# vertical pasting respectively.
#
paste=vpaste # default is vertical pasting
seplist="\t" # default separator is tab
while getopts d:s o
do case "$o" in
d) seplist="$OPTARG";;
s) paste=hpaste;;
[?]) print >&2 "Usage: $0 [-s] [-d seplist] file ..."
exit 1;;
esac
done
shift $OPTIND-1
# perform actual paste command
$paste -d "$seplist" "$@"
EXAMPLE
This is an example of using getopts in a shell script. Compare it to the getopt example.
# Example illustrating use of getopts builtin. This
# shell script would implement the paste command,
# using getopts to process options, if the underlying
# functionality was embedded in hypothetical utilities
# hpaste and vpaste, which perform horizontal and
# vertical pasting respectively.
#
paste=vpaste # default is vertical pasting
seplist="\t" # default separator is tab
while getopts d:s o
do case "$o" in
d) seplist="$OPTARG";;
s) paste=hpaste;;
[?]) print >&2 "Usage: $0 [-s] [-d seplist] file ..."
exit 1;;
esac
done
shift $OPTIND-1
# perform actual paste command
$paste -d "$seplist" "$@"
Thursday, May 23, 2013
How to make DHDall.xyz
#!/bin/bash
DHDfile=($(ls -1 DHD?????.xyz)) # Read all files of DHD?????.xyz
interval=$1 # Interval is the first argument.
: ${interval:=1} # If there is no argument, default value is 1.
if [ -f DHDall.xyz ] # If DHDall.xyz exist
then
rm DHDall.xyz # then delete it.
fi
touch DHDall.xyz # As DHDall.xyz is absent, touch it.
for (( i=0; i < ${#DHDfile[@]} ; i=i+$interval )) do
cat ${DHDfile[$i]} >> DHDall.xyz
done
exit
DHDfile=($(ls -1 DHD?????.xyz)) # Read all files of DHD?????.xyz
interval=$1 # Interval is the first argument.
: ${interval:=1} # If there is no argument, default value is 1.
if [ -f DHDall.xyz ] # If DHDall.xyz exist
then
rm DHDall.xyz # then delete it.
fi
touch DHDall.xyz # As DHDall.xyz is absent, touch it.
for (( i=0; i < ${#DHDfile[@]} ; i=i+$interval )) do
cat ${DHDfile[$i]} >> DHDall.xyz
done
exit
Wednesday, April 10, 2013
iptables setting
# Basic setup
iptables --flush
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -P INPUT DROP
# Allow SSH
iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 22 -j ACCEPT
# Allow local loopback
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# Allow DNS
iptables -A OUTPUT -p udp -o eth0 --dport 53 -j ACCEPT
iptables -A INPUT -p udp -i eth0 --sport 53 -j ACCEPT
# Allow ping
iptables -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT
# Allow http
iptables -A INPUT -i eth0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
# Allow https
iptables -A INPUT -i eth0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT
# Printer (ipp=631, cups=515)
iptables -A OUTPUT -p tcp -d 192.168.60.157 --dport 515 -j ACCEPT
iptables -A INPUT -p tcp -s 192.168.60.157 --sport 515 -j ACCEPT
Monday, March 18, 2013
Monday, March 11, 2013
How to build Goto blas using Intel compilers
Download GotoBlas http://www.tacc.utexas.edu/tacc-projects/gotoblas2
make FC=ifort CC=icc BINARY=64 USE_THREAD=0
The last option is to build without thread. Output message:
GotoBLAS build complete.
OS ... Linux
Architecture ... x86_64
BINARY ... 64bit
C compiler ... INTEL (command line : icc)
Fortran compiler ... INTEL (command line : ifort)
Library Name ... libgoto2_prescott-r1.13.a (Single threaded)
how to disable touch pad
Login as root.
$ xinput list
You will see results similar to
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=15 [slave pointer (2)]
⎜ ↳ Logitech USB Receiver id=11 [slave pointer (2)]
⎜ ↳ Logitech USB Receiver id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Video Bus id=8 [slave keyboard (3)]
↳ Sleep Button id=9 [slave keyboard (3)]
↳ USB 2.0 UVC VGA WebCam id=10 [slave keyboard (3)]
↳ Asus WMI hotkeys id=13 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=14 [slave keyboard (3)]
The touchpad id is 15. To disable it:
$ xinput set-prop 15 "Device Enabled" 0
to re-enable it
$ xinput set-prop 15 "Device Enabled" 1
Monday, February 25, 2013
image convert in Linux
convert -colorspace RGB -interlace none -density 300x300 -quality 100 mycode_pbs-crop.pdf mycode_pbs-crop.png
pbsnodes
To see the status of all nodes:
$ pbsnodes -a
To see down nodes only
$ pbsnodes -l
====================
pbsnodes(8B) PBS pbsnodes(8B)
NAME
pbsnodes - pbs node manipulation
SYNOPSIS
pbsnodes [-{a|x}] [-q] [-s server] [node|:property]
pbsnodes -l [-q] [-s server] [state] [nodename|:property ...]
pbsnodes [-{c|d|o|r}] [-q] [-s server] [-n] [-N "note"] [node|:property]
DESCRIPTION
The pbsnodes command is used to mark nodes down, free or offline. It can
also be used to list nodes and their state. Node information is obtained
by sending a request to the PBS job server. Sets of nodes can be operated
on at once by specifying a node property prefixed by a colon.
Nodes do not exist in a single state, but actually have a set of states.
For example, a node can be simultaneously "busy" and "offline". The
"free" state is the absence of all other states and so is never combined
with other states.
In order to execute pbsnodes with other than the -a or -l options, the
user must have PBS Manager or Operator privilege.
OPTIONS
-a All attributes of a node or all nodes are listed. This is
the default if no flag is given.
-x Same as -a, but the output has an XML-like format.
-c Clear OFFLINE from listed nodes.
-d Print MOM diagnosis on the listed nodes. Not yet imple-
mented. Use momctl instead.
-o Add the OFFLINE state. This is different from being marked
DOWN. OFFLINE prevents new jobs from running on the speci-
fied nodes. This gives the administrator a tool to hold a
node out of service without changing anything else. The
OFFLINE state will never be set or cleared automatically by
pbs_server; it is purely for the manager or operator.
-p Purge the node record from pbs_server. Not yet imple-
mented.
-r Reset the listed nodes by clearing OFFLINE and adding DOWN
state. pbs_server will ping the node and, if they communi-
cate correctly, free the node.
-l List node names and their state. If no state is specified,
only nodes in the DOWN, OFFLINE, or UNKNOWN states are
listed. Specifying a state string acts as an output fil-
ter. Valid state strings are "free", "offline", "down",
"reserve", "job-exclusive", "job-sharing", "busy", "time-
shared", or "state-unknown".
-N Specify a "note" attribute. This allows an administrator
to add an arbitrary annotation to the listed nodes. To
clear a note, use -N "" or -N n.
-n Show the "note" attribute for nodes that are DOWN, OFFLINE,
or UNKNOWN. This option requires -l.
-q Supress all error messages.
-s Specify the PBS server’s hostname or IP address.
SEE ALSO
pbs_server(8B) and the PBS External Reference Specification
Local pbsnodes(8B)
$ pbsnodes -a
To see down nodes only
$ pbsnodes -l
====================
pbsnodes(8B) PBS pbsnodes(8B)
NAME
pbsnodes - pbs node manipulation
SYNOPSIS
pbsnodes [-{a|x}] [-q] [-s server] [node|:property]
pbsnodes -l [-q] [-s server] [state] [nodename|:property ...]
pbsnodes [-{c|d|o|r}] [-q] [-s server] [-n] [-N "note"] [node|:property]
DESCRIPTION
The pbsnodes command is used to mark nodes down, free or offline. It can
also be used to list nodes and their state. Node information is obtained
by sending a request to the PBS job server. Sets of nodes can be operated
on at once by specifying a node property prefixed by a colon.
Nodes do not exist in a single state, but actually have a set of states.
For example, a node can be simultaneously "busy" and "offline". The
"free" state is the absence of all other states and so is never combined
with other states.
In order to execute pbsnodes with other than the -a or -l options, the
user must have PBS Manager or Operator privilege.
OPTIONS
-a All attributes of a node or all nodes are listed. This is
the default if no flag is given.
-x Same as -a, but the output has an XML-like format.
-c Clear OFFLINE from listed nodes.
-d Print MOM diagnosis on the listed nodes. Not yet imple-
mented. Use momctl instead.
-o Add the OFFLINE state. This is different from being marked
DOWN. OFFLINE prevents new jobs from running on the speci-
fied nodes. This gives the administrator a tool to hold a
node out of service without changing anything else. The
OFFLINE state will never be set or cleared automatically by
pbs_server; it is purely for the manager or operator.
-p Purge the node record from pbs_server. Not yet imple-
mented.
-r Reset the listed nodes by clearing OFFLINE and adding DOWN
state. pbs_server will ping the node and, if they communi-
cate correctly, free the node.
-l List node names and their state. If no state is specified,
only nodes in the DOWN, OFFLINE, or UNKNOWN states are
listed. Specifying a state string acts as an output fil-
ter. Valid state strings are "free", "offline", "down",
"reserve", "job-exclusive", "job-sharing", "busy", "time-
shared", or "state-unknown".
-N Specify a "note" attribute. This allows an administrator
to add an arbitrary annotation to the listed nodes. To
clear a note, use -N "" or -N n.
-n Show the "note" attribute for nodes that are DOWN, OFFLINE,
or UNKNOWN. This option requires -l.
-q Supress all error messages.
-s Specify the PBS server’s hostname or IP address.
SEE ALSO
pbs_server(8B) and the PBS External Reference Specification
Local pbsnodes(8B)
Sunday, February 24, 2013
Efficient yum installation
- Make a directory such as /etc/yum/Group, which is shared to all the nodes using NFS.
- Download package files:
- yum groupinstall -y 'Development Tools' --downloadonly --downloaddir=/opt/yum/Group
- yum update --downloadonly --downloaddir=/opt/yum/ openmpi openmpi-devel openmpi-devel.x86_64 qt-devel cc gcc-c++ bison ncurses-devel tix.x86_64 glibc-devel flex zlib-devel libXt-devel binutils-devel gcc44 gcc44-c++ zlib-devel
- If "--downloadonly" option does not work, then
- yum install -y yum-downloadonly
- To install downloaded package at the master as well as compute nodes:
- yum localinstall -y /opt/yum/Group/*.rpm
- If you get errors regarding yum execution, try
- yum clean dbcache
yum download
Type the following command to install plugin, enter:
# yum install yum-downloadonly
To download http only:
# yum update httpd -y --downloadonly
Saturday, February 23, 2013
How to install OpenFOAM on CentOS
- Package Installation
- sudo yum groupinstall -y 'Development Tools'
- sudo yum install -y openmpi openmpi-devel openmpi-devel.x86_64 qt-devel
- sudo yum install -y cc gcc-c++ bison ncurses-devel tix.x86_64 glibc-devel flex zlib-devel libXt-devel binutils-devel
- sudo yum install -y gcc44 gcc44-c++ zlib-devel
- yum upgrade -y
- Check your OS architecture to forcefully load Open-MPI into the environment
- uname -m
- If 32 bit:
- mpi-selector --system --set openmpi-1.4-gcc-i386
- If 64 bit:
- mpi-selector --system --set openmpi-1.4-gcc-x86_64
- In my case, "openmpi-1.4-gcc-x86_64" is not listed by executing "mpi-selector --list". To register openmpi-1.4-gcc-x86_64:
- mpi-selector --register openmpi-1.4-gcc-x86_64 --source-dir /usr/lib64/openmpi/1.4-gcc/etc
- Log out and log in again. If you did step 1 and 2 as root, at this time log in as a regular user.
- Download and unpack
- cd ~
- mkdir OpenFOAM
- cd OpenFOAM
- wget "http://downloads.sourceforge.net/foam/OpenFOAM-2.1.1.tgz?use_mirror=mesh" -O OpenFOAM-2.1.1.tgz
- wget "http://downloads.sourceforge.net/foam/ThirdParty-2.1.1.tgz?use_mirror=mesh" -O ThirdParty-2.1.1.tgz
- tar xzf OpenFOAM-2.1.1.tgz
- tar xzf ThirdParty-2.1.1.tgz
- For X86 #here you can change 4 to the number of cores you've got
- source $HOME/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc WM_NCOMPPROCS=4 WM_COMPILER=Gcc44 WM_MPLIB=SYSTEMOPENMPI
- export WM_CC='gcc44'
- export WM_CXX='g++44'
- echo "source $HOME/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc $FOAM_SETTINGS" >> $HOME/.bashrc
- echo "export WM_CC='gcc44'; export WM_CXX='g++44'" >> $HOME/.bashrc
- sed -i -e 's=gcc=$(WM_CC)=' OpenFOAM-2.1.1/wmake/rules/linux64Gcc44/c
- sed -i -e 's=g++=$(WM_CXX)=' OpenFOAM-2.1.1/wmake/rules/linux64Gcc44/c++
- Now let's build OpenFOAM. It usually takes 30 minutes to 6 hours.
- #Go into OpenFOAM's main source folder
- cd OpenFOAM-2.1.1
- # This next command will take a while... somewhere between 30 minutes to 3-6 hours.
- ./Allwmake > make.log 2>&1
- #Run it a second time for getting a summary of the installation
- ./Allwmake > make.log 2>&1
Preliminary
OpenFOAM uses libmpi.so.1. If this is not found in /usr/lib64/openmpi/1.4-gcc/lib, then do followings
- Log in as root
- cd /usr/lib64/openmpi/1.4-gcc/lib
- ln -s libmpi.so libmpi.so.1
This is to make a symbolic link from libmpi.so to libmpi.so.1, which should be done all the nodes if OpenFoam will be run in parallel.
Related links:
http://wiki.hpc.ufl.edu/doc/From_mpi-selector_to_environment_modules
http://na-inet.jp/na/pccluster/centos_x86_64-en.html
Wednesday, February 20, 2013
UseDNS no in sshd_config
"It turns out there is a setting in OpenSSH that controls whether SSHd should not only resolve remote host names but also check whether the resolved host names map back to remote IPs. Apparently, that setting is enabled by default in OpenSSH. The directive UseDNS controls this particular behaviour of OpenSSH, and while it is commented in sshd_config (which is the default configuration file for the OpenSSH daemon in most enviornments), as per the man page for sshd_config, the default for UseDNS is set to enabled. Uncommenting the line carrying the UseDNS directive and setting it to “no” disables the feature."
http://ayaz.wordpress.com/2008/02/03/usedns-resolution-and-openssh/
So to speed up connection speed of OpenSSH, in /etc/ssh/sshd_config file, put
UseDNS no
http://ayaz.wordpress.com/2008/02/03/usedns-resolution-and-openssh/
So to speed up connection speed of OpenSSH, in /etc/ssh/sshd_config file, put
UseDNS no
Tuesday, February 19, 2013
PBS scripts for mpirun
#!/bin/bash
#PBS -l walltime=00:30:00
#PBS -l nodes=3:ppn=2
#PBS -N mypi
#PBS -V
cd $PBS_O_WORKDIR
/opt/openmpi-1.6.3-intel-pbs/bin/mpirun -mca btl_tcp_if_include eth0 -mca btl tcp,self -mca plm tm -np 6 fpi.x
Thursday, February 14, 2013
How to install Openmpi using ifort and icc
$ ./configure --with-tm=/usr/include/torque/ --prefix=/opt/openmpi-1.6.3-intel-pbs CC=icc CXX=icpc F77=ifort FC=ifort
$ make all install
openssh reinstallation
sudo apt-get remove --purge openssh-server
sudo apt-get install openssh-server
resolve memtest86+ (4.20-1.1ubuntu1) hangs
Quick workaround:
GRUB_DISABLE_ OS_PROBER= true
This will disable os-prober so grub doesn't see the other disks (this way it won't fail with an error).
Run sudo dpkg --configure -a to complete the configuration (should be successful this time).
The side-effect of this workaround is that you will loose all other boot entries in GRUB, so if you have a Windows dual boot or other distro's, you should remove or comment the line in /etc/default/grub and then run sudo update-grub2 once more to fully populate the GRUB menu.
Append the following to /etc/default/grub:
GRUB_DISABLE_
Run
$ sudo update-grub2
Run sudo dpkg --configure -a to complete the configuration (should be successful this time).
The side-effect of this workaround is that you will loose all other boot entries in GRUB, so if you have a Windows dual boot or other distro's, you should remove or comment the line in /etc/default/grub and then run sudo update-grub2 once more to fully populate the GRUB menu.
How to resolve “Could not get lock /var/lib/dpkg/lock” problem.
Delete two "lock" files. sudo rm /var/lib/dpkg/locksudo rm /var/cache/apt/archives/lock
Subscribe to:
Posts (Atom)
Labels
- Academic Notes (4)
- BLAS (1)
- CEE618 (2)
- CentOS (1)
- Computation (1)
- Conferences (1)
- Cross compiling (1)
- Graphics (1)
- Hawaii Tour (2)
- Intel compiler (1)
- Just (1)
- Laptop (1)
- LaTex (22)
- Life and Humanity (8)
- Linux and Computing (107)
- LSF (1)
- Lyx (3)
- Macintosh (5)
- MPI (1)
- News (11)
- OpenFoam (1)
- OpenMPI (1)
- PBS (2)
- Software (4)
- SSH (2)
- torque (1)
- Touchpad (1)
- VMD (1)
- yum (1)