Compiling Fortran-77 code in Ubuntu-16

Leave a comment

Fortran-77 is a very old code, who lives in 32-bit computer.

In Ubuntu-16, the compiler g++, gcc, or gfortran are “basically the same” (as far as I understand, correct me if I am wrong.) that they only support fortran-95.

In order to compile Fortran-77 code, I tried many way, but the only way is install g77 from external source, and add -m32 for the compiling flag.

The g77 compiler can be downloaded in here (I download from the web, If I violated some copy right, please let me know):

https://drive.google.com/file/d/0BycN9tiDv9kmR1dhUjZKS0tzTk0/view?usp=sharing

or, people can search in google by

 g77_x64_debian_and_ubuntu.tar.gz

 

people need to extract, change the mod of install.sh to be executable.

 tar -xzvf g77_x64_debian_and_ubuntu.tar.gz
 cd g77_x64_debian_and_ubuntu
 chmod +x ./install.sh
 ./install.sh

 

Somehow, you may face an error in apt-get, saying

Errors were encountered while processing:
g77-3.4-doc 

you can remove that by

cd /var/lib/dpkg/info
sudo rm g77-3.4-doc*
sudo dpkg --remove --force-remove-reinstreq g77-3.4-doc

Thanks (here)

Hope it help. :)


 

Advertisements

compile old 32bit Fortran code on 64bit machines

Leave a comment

as simple as adding compiler argument “-m32”

for example, my fortran compiler is gfortran, then to compile old 32bit fortran code:

gfortran -m32 <infile> -o <outfile>

that is.

 

AnaPAW – an introduction

Leave a comment

In RIKEN Nishina Center for Accelerator-Based Science, the analysis program is called AnaPAW, which is Ana + PAW. PAW is an old analysis program developed by CERN, and no longer supported. It is going to be replaced by ROOT.

PAW is based on Fortran 77. Ana is a package for reading the speciallized data format (.ridf) in RIKEN.

some terminology for AnaPAW:

  • analyzer : a program for analyzing the raw data. some analyzers will be shared by difference detectors of same type. i.e. if there are many plastic scintillators, they may use a same program for processing the raw data.
  • analyzer ID : which is the number for each analyzer, also called analyzer flag
  • ID : this usually referring which “detectors” you want to get in an analyzer.
  • W# : what kind of data you want.
  • enc*.f : analyzer code file
  • *.fh : common value file
  • *.ana : ana code file. this file specific which analyzers will be called, and want histogram will be filled

the flow of AnaPAW is:

  1. call a data file ready to read. But NOT read yet.
  2. using an “ana code” file (.ana), calling “analyzers” ( analyzing program ), and specific which data will be plotted.
  3. the AnaPaw will read the data file according to the ana code file specification.
  4. fill histograms according to ana code file
  5. loop the data file to next data block
  6. select which histogram to plot.

one difficulty of using anapaw is that, the relationship of analyzers are hidden in the code. Some analyzers are independent, but most of them are dependent. This dependence is due to the calling of other analyzer value (common value). in order to get the common value, other analyzer must be run in advance. thus, to use an analyzer, we have to check the enc*.f file to see which analyzer is needed.

another difficulty is that, to know how to use the analyzer, we have to read the code file and most of them have comment on the top.

i always suggest they use include the analyzer dependency in the comment. However, since the dependency can be multiple levels. i.e. A depends on B, B depends on C, and so on. thus, that make anapaw is very scary for beginner.