Many people come to me to fix this or that problem in computation. Mostly those problems are related to installing or running a software package. I have found that in most cases the problems arise due to poor understanding of some basic things. In what follows, I will discuss a few things which if you understand clearly can make your life easy.
For LSF healp see this .
There are many situations in which you want to login a machine B (Linux) from machine A (Linux) using ssh without giving password. This may be necessary also for program like Mesaage Passing Intercae (MPI). You can achive this in three simple steps:
Generate ssh keys in machine A
jayanti@machineA$ ssh-keygen
which will create a file 'id_rsa.pub' inside the directory '.ssh'. In second step you have to copy the id_rsa.pub file from machine A to .ssh/authorized_keys of machine B
scp ~/.ssh/id_rsa.pub jayanti@machineB:~/.ssh/authorized_keys
In the last step you can login to machine B from A without password.
jayanti@machineA$ ssh jayanti@machineB
On a Linux system most software packages are installed in the form of libraries which are either dynamic (.so files or "shared objects") or static libraries (.a files). Here I do not want to discuss about what static and dynamic libraries are, I just want to answer the following questions:
In every software package, which is distributed in the form of a source code (FORTRAN or C files), there are a large number of files which contain programs for doing many things. In most cases there are programs in a code which can be used in some other codes also and it makes sense to pack them into a single library file which can be easily used by other codes. By creating a library we can pack a large number of program files in a single library file .
gcc -c sum.c gcc -c diff.c
This will create two files named sum.o and diff.o from which we can create a static library file named libmymath.a in the following way:
ar rc libmymath.a sum.o diff.o
This will create a library file named libmymath.a
Shared/dynamic libraries can be created in the following way
gcc -Wall -g -shared -Wl,-soname,libtest.so.0 -o libtest.so.0 sum.o diff.o
For example download this .tar.gz file.
We can write the following main program main.c which uses the function sum and diff which are packed in the library libmymath.a .
#include#include #include int sum (int, int); int diff(int, int); int main(int argc, char *argv[]){ int a, b, c, d; printf("give two number \n"); scanf("%d %d",&a,&b); c=sum(a,b); d=diff(a,b); printf("sum=%d. diff=%d\n",c,d); return(0); }
Now there are the following two way to use the library. In the first case we use:
gcc main.c libmymath.a -lm
This is not the common way by which libraries are used. In general we use the PATH of the directory where the library file is and then use -lnameoflib . For example, in the present case we can use:
gcc main.c -L/PATH -lmymath
Note that in the present case the name of the library is libmymath.a so we use -lmymath . We add a - sign and replace lib by l and do not use .a.
I have my GSL library named libgsl.a in the directory /data/software/gsl/lib/ so I should use
gcc main.c -L/data/software/gsl/lib -lgsl
to use the gsl library. Note that you may be having your own compilation options do not forget them.
Another most standard way to use library is to put the path of your library in your .bashrc file. For example in the case of my GSL, I can put the following two lines in my .bashrc file:
LD_LIBRRAY_PATH=$LD_LIBRRAY_PATH:/data/software/gsl/lib export LD_LIBRRAY_PATH
and after that I must do:
source .bashrc
After doing all this now I do not have to give the full path of the library and I can use
gcc main.c -lgsl
Note that sometime it may happen that the name of the library you want to use does not start from lib . In that situation you must give the full name of the library at the time of compiling/running the program. For example if you have a library like lapack_LINUX.a you can use that in the following way:
gfortran test.f90 PATH/lapack_LINUX.a
where path may be like /data1/software/lapack/lapack-3.3.1
In order to know all the libraries installed on your Linux computer and their version run:
/sbin/ldconfig -p
In order to know which of the libraries are used by a binary executable use the command ldd . For example the following command tells us which of the libraries are used by the command ls
ldd /bin/ls
A very good introduction of libraries is given here .
In general with every software package there are header files or .h which contains the values of parameters, variable definition and specification for functions and we must give the path of these files using the -I files. In the case of my GSL I must use:
gcc main.c -L/data/software/gsl/lib -lgsl -I/data/software/gsl/include
After knowing all this, there is no reason for you not being able to use a library, if you know where your library files ( .a) and header files (.h ) are.
I will add more about libraries later on, however, in case you have any problem, mail me at [prasad.jayanti@gmail.com]
In order to create a simple banner do the following :
convert -size 650x100 -background transparent -fill blue \ -pointsize 64 -gravity center 'label:JP Media & Art Work' logo.png
Note the following things :
If you want to write a full paragraph with line breaks, do the following:
convert -size 600x180 -background transparent -fill blue \ -pointsize 32 -gravity center caption:'Sometime sky becomes so dark\n I cannot see stars and lose track \n when you recognize me \n I know I have not gone too far' poem1.png
here '\n' is used for line break. If you want to change the color of background and text you can do that using:
convert -size 650x100 -background gray -fill blue -pointsize \ 64 -gravity center 'label:JP Media & Art Work' logo.pngFor my image-magic notes click here .
mencoder video3.avi -ofps 25 -o clip1.avi -oac lavc -ovc lavc -vf scale=320:240 -ss 59 -endpos 15
mencoder clip1.avi clip2.avi clip3.avi -o result.avi -oac lavc -ovc lavc
ffmpeg -i uttarakhand...Paradise_on_Earth.mp4 -f mp3 -ab 192000 -vn music.mp3
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=joined.pdf file1.pdf file2.pdfThere is no limitation on the number of files.
pdftk old.pdf cat 1-9 26-end output new.pdfAnother command is :
gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dFirstPage=m -dLastPage=n -sOutputFile=output.pdf input.pdf