Compile/Link/Run in a LINUX ENVIRONMENT
Running programs in a remote LINUX environment differs from running in windows
or on a LINUX based desktop.
The first step is opening an account, which for TAMNUN is done by
completing the web form and for PHELAFEL/PHCLASSES is done by filling in the
registration form , printing it and handing in to your lecturer or to
You need to have an account on TX(staff)/T2 for TAMNUN and on
TX/T2 or PHYSICS for PHELAFFEL/PHCLASSES before requesting an account.
For the rest of these pages the name TAMNUN
is used, but the course will also run on ALUF but ifAMNUN is not yet ready. Everything except the PBS link also applies to PHELAFEL/PHCLASSES.
Likewise when TX (staff) is used it is also applicable to T2 and PHYSICS.
The next step is to follow thru and simply read the pages in order without taking any actions yet.
Then, if you are in a course your will be given a temporary training account
to use in class. If you are working thru the webpages alone, you need your account to continue. In either case it will be called YOURACCOUNT in the following.
Once you have an account and have read the pages once, proceed as follows:
If you are coming from a LINUX machine (like the ones in Rm 316)
you can start doing as instructed below. If you are on windows you need to
exercise one of the options listed on the remote access page. If you are in a TAMNUN preliminary course with your own laptop
there will be people to help you at this stage or you can make an appointment with Julia at firstname.lastname@example.org.
LINUX computers are case-sensitive so account and file names must
be in the correct case. The filenames File.c and file.c
are not the same!.
Your account, known below as ``YOURACCOUNT''
has several attributes. It has a home directory, known as ~YOURACCOUNT
which is where your files sit
and a shell, which defines some of the rules. A common choice is tcshell
which works well if a file called .cshrc is placed in the main directory, see below.
When you have read all the pages and decided how to access TAMNUN
the next step is to open a window there to run programs.
In that window or in any window of your desktop
if you are coming from a different LINUX computer you access
TAMNUN with the command
ssh tamnun -X -l YOURACCOUNT
if the account name is the same you can drop the -l YOURACCOUNT.
The command ssh is a secure login and details about it are here.
The -X (or -Y) means that your TAMNUN window can open windows on your
If you come from outside the Technion firewall you will need to go into TAMNUN by first logging in to TX and then to TAMNUN.
SETTING UP YOUR ACCOUNT
First check if a file calle .cshrc is already installed in your account by writing:
If yes (i.e. if you get the file listed) go on to the list of basic commands below.
If not, a sample .cshrc file called .cshrc.TAMNUN can be downloaded here.
the editing and managing files link for how to do this
and place it in the home directory. Immediately change its name to .cshrc by the command
mv .cshrc.TAMNUN .cshrc
run the command source .cshrc
and every time after that when you logon, you will get a nice prompt like: A nice list of basic commands for LINUX, prepared by Riva Kreiselman is here. Important ones are ls, mkdir, cd ....., more
which helps you know which window is the right one to use. You will also have paths to your files sorted out. (The illustrative prompt here is on phelafel, since TAMNUN had not arrived when this was written; and its shows how the prompt changes when you change your directory e.g. from ~phr76ja to ~phr76ja/public_html.)
more is a way to see whats in a file without opening an editor.
Now for the important stuff!
COMPILE, LINK and RUN
The environment for running jobs is different in principle to using a desktop pc. Instead of entering an environment where you write your file and then run it, you
take 4 seperate stages - edit, compile and link and run (although often the compile and link are combined) after you have opened a window:
You can run the job in the background by writing
- First you prepare one or more files in C/FORTRAN/C++ etc. You do this with an editor and this is explained in the next link.
Lets start with a simple file, for example one I used in my last
Computational Physics class called surlin.f. You can use it ``as is'' for this
introduction. Check if it is there using the ls command and if not get it by
scp course01@aluf:surlin.f .
and using the same password as given for your account on aluf.
The period following the space at the end of the command line is a short way to say ``put the copied file in the current directory''.
(If you are taking the course alone, you will need to scp it after downloading from the web onto some other computer - say one called YOURMACHINE - and then
either sending it from YOURMACHINE with winscp or copying into ALUF from say YOURACCOUNT@YOURMACHINE by
writing on ALUF scp YOURACCOUNT@YOURMACHINE:surlin.f . )
- Once your file is ready, you have to compile it and then link the different parts. At this stage you create a file that will be executable, and for
surlin.f the command is:
f77 surlin.f -o surlin.ex
where the -o means make a final executable file called surlin.ex
and you should change this if you are compiling a different file.
This is about as easy as it gets, and for more complex programs its good to work with makefiles, which are explained here. There are also many other compilers
which will be discussed in detail in a more advanced setting.
In brief, documentation about Intel compilers is at:
Intel(R) C Compiler XE for Linux, Version 126.96.36.1996
Intel(R) C++ Compiler XE for Linux, Version 188.8.131.526
Intel(R) Fortran Compiler XE for Linux, Version 184.108.40.2066
- The final stage is execution which for the example file is just to write the command:
Once the job is finished, you can look at the files it has created with the ls command.
For example, surlin.ex creates the file youraccount.out
which you can view with the more command.
Your next page is editing and managing files in a LINUX environment.
NANCO/TAMNUN users and Technion Physics Department graduate students may contact
Dr Joan Adler (phr76ja_at_tx.technion.ac.il) with further questions,
OTHERS ARE WELCOME TO USE THE SITE ``AS IS''.
- Course homepage
- How working on a remote LINUX machine differs from using your desktop - compile/link/run in LINUX
- Editing and moving files in a LINUX environment
- Accessing a remote LINUX machine from the windows environment
PBS queueing system - by Julia Halupovich