environment modules for gcc/gfortran?
Katherine Holcomb
kah3f@virginia.edu
Tue Mar 27 16:49:00 GMT 2012
You need to roll your own modules script. They are fairly simple Tcl
scripts with some extensions. So you would install the newer version
into some unique location -- don't make it fight with the system gcc in
/usr. Let's say it's in /opt/gcc-4.7 (and will include g++ and
gfortran). It would be like
######################################################################
##
##
proc ModulesHelp { } {
global version GCChome
puts stderr "\tGCC\n"
puts stderr "\tThis module loads the latest version of
gfortran/gcc/g++.\n"
}
module-whatis "loads the latest GCC Compiler Environment"
# for Tcl script use only
set version 4.7
set GCChome /opt/gcc-$version
prepend-path PATH $GCChome/bin
prepend-path INCLUDE $GCChome/include
prepend-path LD_LIBRARY_PATH $GCChome/lib
prepend-path MANPATH $GCChome/man
---------
You'd have to adjust the paths since these aren't the way gcc usually
installs (this is a modification of my script for Intel--we roll our own
for that also since we don't use the default installation directory).
This would put the newer gfortran into the path before the older one
(the prepend-path does that). It will go into some directory usually
called /something/something/Modules/modulefiles (often the prefix is
/usr/local or /usr/share). Each software environment must be in its own
subdirectory under that directory, so you'd make a directory
newgcc
or whatever you want to call it, and the above file, with appropriate
modifications, would be in that directory under the name 4.7 (i.e. the
name is the version number). You can have a script for more than one
version in a directory and by default it will use the highest number.
You would then load it with
module load newgcc
or you can use
module load newgcc/4.7
to explicitly choose the version.
The manpages at the modules homepage (the sourceforge link in your
original email), especially the one for "modulefile," have a bit of
documentation about these scripts, in particular the extensions like
prepend-path and append-path.
On 03/27/2012 11:45 AM, Tom Roche wrote:
> > From where can one obtain environment modules for gcc/gfortran?
> What I mean:
>
> Folks in my group (which develops a scientific model) want for us to
> support (and therefore to regularly build/test on) gcc/gfortran.
> Unfortunately our cluster is running
>
> $ lsb_release -ds
> "Red Hat Enterprise Linux Server release 5.4 (Tikanga)"
> $ gfortran --version
> GNU Fortran (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46)
>
> which is obviously downlevel (3.75 years next week). We currently
> support pgi and ifort, which our cluster managers keep much more
> up-to-date using Environment Modules
>
> http://sourceforge.net/projects/modules/
>
> such that
>
> $ module avail 2>&1 | fgrep -ie 'intel'
> intel openmpi_pgi
> intel-11.1 pgi
> intel-12.0 pgi-11.8
> intel-12.1 pgi-11.9
> intel_ilp64 pgimpi
> intel_lp64 pgimpi-11.9
> intelmpi pvm3
>
> I believe we get the modulefiles (or whatever one needs to setup a module on a given host or cluster) for those modules from the vendor. Can one also get modulefiles for gcc/gfortran from somewhere? or must one "roll their own"? If the latter, are there instructions for how to do that?
>
> TIA, Tom Roche<Tom_Roche@pobox.com>
--
Katherine Holcomb
UVACSE kholcomb@virginia.edu
112 Albert Small Building (434) 982-5948
University of Virginia Charlottesville, VA 22904
More information about the Fortran
mailing list