User Tools

Site Tools


hpc:alpgenbuildingnotes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
hpc:alpgenbuildingnotes [2014/01/09 16:17]
jchilders old revision restored (2014/01/09 10:01)
hpc:alpgenbuildingnotes [2014/01/09 16:40]
jchilders old revision restored (2014/01/09 10:01)
Line 1: Line 1:
 ===== Building ALPGEN ===== ===== Building ALPGEN =====
 +
 +==== Machine dependent compile time changes ====
  
 === For BG/P ===  === For BG/P === 
Line 71: Line 73:
 ---- ----
  
- +Run \\ 
-module swap PrgEnv-pgi PrgEnv-gnu \\+''module swap PrgEnv-pgi PrgEnv-gnu'' \\
 That requires ''compile.mk'' to have the following changes That requires ''compile.mk'' to have the following changes
 <code make> <code make>
Line 87: Line 89:
 === Edison === === Edison ===
 ---- ----
- +Run \\ 
-module swap PrgEnv-intel PrgEnv-gnu +''module swap PrgEnv-intel PrgEnv-gnu'' \\ 
- +That requires ''compile.mk'' to have the following changes 
-That requires compile.mk to have the following changes +<code make>
 ifeq ($(shell uname),Linux) ifeq ($(shell uname),Linux)
 #  FFF = gfortran -fno-automatic #  FFF = gfortran -fno-automatic
Line 100: Line 101:
 #        -ffast-math #        -ffast-math
 endif endif
 +</code>
  
 +==== Introduce MPI to Alpgen ====
  
-2) Deal with MPI +=== Edits to ''alplib/alpgen.f'' === 
- +----
-2.1) Add the lines+
  
 +In subroutine ''alsdef'' in file ''alplib/alpgen.f'' near line 209, just after \\
 +''c common declarations'' \\
 +add these lines
 +<code fortran>
       integer mpirank       integer mpirank
       character*5 rankstring       character*5 rankstring
       common/mpi/mpirank,rankstring       common/mpi/mpirank,rankstring
- +</code> 
-Just after the line "c common declarations" in subroutine alsdef in file alpgen.f +---- 
-It will be near line 209 +Near line 230, just before \\ 
- +''c list processes'' \\ 
-2.2 Add the lines +sdd the lines 
 +<code fortran>
 C MPI variables C MPI variables
       include 'mpif.h'       include 'mpif.h'
       integer rank, size, ierror, tag, status(MPI_STATUS_SIZE)       integer rank, size, ierror, tag, status(MPI_STATUS_SIZE)
- +</code> 
-Just before the line "c list processes" This will be near line 230 +Following the remaining variable definitions, add this code 
 +<code fortran>
 c beginning of MPI block c beginning of MPI block
 +c  retrieve MPI rank information
       call MPI_INIT(ierror)       call MPI_INIT(ierror)
       call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierror)       call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierror)
Line 129: Line 136:
       write(6,*) 'MPI finalized: rank ', mpirank       write(6,*) 'MPI finalized: rank ', mpirank
       write( rankstring, '(i5.5)' )  mpirank       write( rankstring, '(i5.5)' )  mpirank
 +c   work in this threads unique directory
 +      call chdir('work',retval)
 +      if(retval.ne.0) then
 +         write(6,*) 'Error changing directory to "work" '
 +      endif
 +      call chdir(rankstring,retval)
 +      if(retval.ne.0) then
 +         write(6,*) 'Error changing directory to ',rankstring
 +      endif
 c end of MPI block c end of MPI block
- +</code> 
- +---- 
-2.3) Add the lines +Just after the lines (near line 338) 
- +<code fortran>
-c work in a unique directory ./work/rankstring +
-      call chdir("work") +
-      call chdir(rankstring) +
- +
-Immediately after the end of the MPI block +
- +
-2.4) Just after the lines+
- +
 c     save parameter values to relative variables in common blocks c     save parameter values to relative variables in common blocks
       call alspar       call alspar
- +</code>
-This will be near line 338: +
 Add the lines Add the lines
 +<code fortran>
 c beginning of MPI block c beginning of MPI block
       iseed(1)=iseed(1)+mod(mpirank,65536)       iseed(1)=iseed(1)+mod(mpirank,65536)
Line 155: Line 160:
       print*, 'Seeds and mpirank', iseed(1),iseed(2),mpirank       print*, 'Seeds and mpirank', iseed(1),iseed(2),mpirank
 c end of MPI block c end of MPI block
- +</code> 
- +---- 
- +In subroutine ''alstio'', just after 
- +<code fortran> 
- +      include 'alpgen.inc' 
-2.3 In subroutine alstio, just after  include 'alpgen.inc'+</code>
 (near line 4584) add the lines: (near line 4584) add the lines:
 +<code fortran>
       integer mpirank       integer mpirank
       character*5 rankstring       character*5 rankstring
       common/mpi/mpirank,rankstring       common/mpi/mpirank,rankstring
- +</code> 
- +---- 
-2.3 In subroutine alstio, replace +Near line 4588, replace 
-  +<code fortran> 
-call alustc(fname,'.wgt',tmpstr) +      call alustc(fname,'.wgt',tmpstr) 
 +</code>
 with  with 
- +<code fortran> 
-call alustc('../../'//fname,'.'//rankstring//'.wgt',tmpstr) +      call alustc('../../'//fname,'.'//rankstring//'.wgt',tmpstr) 
 +</code>
 immediately after immediately after
- +<code fortan> 
-         write(6,*) 'Run parameters and diagnostics written to '+      write(6,*) 'Run parameters and diagnostics written to '
             ,tmpstr(1:l)             ,tmpstr(1:l)
- +</code> 
- +This outputs the weighted event files in a common directory 
-Near line 4588. This outputs the weighted event files in a common directory +---- 
- +Replace unit ''5'' with unit ''9'' for input near line 306, after \\ 
-3) Replace unit 5 with unit 9 for input +''C MANDATORY INPUTS add'' \\ 
- +For BlueGene 
-Near line 306, after C MANDATORY INPUTS add +<code fortran>
-for BlueGene+
       open(9,file='../../input.1',action='read'       open(9,file='../../input.1',action='read'
-for Carver+</code> 
 +For Carver 
 +<code fortran>
       open(9,file='../../input.1',access='read'       open(9,file='../../input.1',access='read'
- +</code> 
-This reads the input configuration from file, instead of from the command line input via a redirect as in the tutorial +This reads the input configuration from file, instead of from the command line input via a redirect as in the tutorial. 
- +Then replace all \\ 
-Then replace all READ(5, with READ(9, +''READ(5,'' \\ 
- +with \\ 
 +''READ(9,'' 
 +This ensures everywhere is reading from the input file instead of ''stdin''. Only change this in the ''alplib/alpgen.f'' file.
  
  
  
hpc/alpgenbuildingnotes.txt · Last modified: 2014/03/24 13:08 by jchilders