Search This Blog

Tuesday, October 28, 2014

How to directly launch Lyx on Mac

This tip is originally to work around the bug of Mac Yosemite that BASH environment is not inherited to child applications.

In terminal, type and enter


$  /Applications/LyX.app/Contents/MacOS/lyx &

If necessary, reconfigure and restart.


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

Monday, March 31, 2014

How to install openlava in Ubuntu



1) prerequisite:
    sudo apt-get install python-software-properties         
   
2) add ppa
    sudo add-apt-repository ppa:cansmith/ol

3) update repository
    sudo apt-get update

4) install openlava
    sudo apt-get install --yes openlava

5) edit /etc/hosts: the first line
from
    127.0.0.1       localhost
to
    127.0.0.1       myhostname  localhost

6) setup configuration
- Go to openlava directory
    cd /etc/openlava/
- open openlava.sh
    sudo vi openlava.sh
- change
    LSF_ENVDIR=/usr/etc
  to
      LSF_ENVDIR=/etc/openlava
- source it
    . ./openlava.sh
- add it to ~/.bashrc
    echo ". /etc/openlava/openlava.sh " >> ~/.bashrc
     
7) check openlava status in /etc/openlava
    sudo ./openlava status
the output must look like
lim pid: <>
res pid: <>
sbatchd pid: <>
lim mbatchd: <>
(without any numbers in <>)

8) start openlava
    sudo ./openlava start
the output must look like
Starting daemons...
lim started
res started
sbatchd started

9) Check a couple of commands:
albertsk@heyum:openlava$ bhosts
HOST_NAME          STATUS       JL/U    MAX  NJOBS    RUN  SSUSP  USUSP    RSV
heyum              ok              -      8      0      0      0      0      0


albertsk@heyum:openlava$ bjobs
No unfinished job found

albertsk@heyum:~$ bhist
No matching job found

10) run the first job
- go to home directory
    cd
- make a test directory
    mkdir bsub
    cd bsub
- edit a job file job.bsub:
#BSUB-q normal                  # Job queue
#BSUB-J myfirstjob              # name of the job
#BSUB -o lava-%J.out
#BSUB -e lava-%J.err
hostname
pwd
ls -laF

- submit the job
    bsub < job.bsub
- try following commands: bjobs, bhist, bpeek   

   
   



 

Sunday, March 23, 2014

how to use at command with output

at -m -f myscript.sh now > test.txt  2>&1


source: http://kb.iu.edu/data/aewo.html#examples

openssl installation on Mac



1. Download openssl:  openssl-1.0.1f.tar.gz
2.
./configure darwin64-x86_64-cc --prefix=/usr/local/openssl-1.0.1f
make make install


http://mac-dev-env.patrickbougie.com/openssl/

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!



Saturday, March 8, 2014

bash script default input values

#!/bin/sh
dir1=$1
dir2=$2
: ${dir1:="TxtInOut-serial"}
: ${dir2:="TxtInOut-omp-02"}

Labels

Blog Archive