Computer Aided Engineering Journal & Forums

  • Home
  • Forums
  • Help
  • Search
  • Contact
  • Members
Current time: 09-08-2010, 11:13 AM



Computer Aided Engineering Journal & Forums / Documentation & Book Keeping / Tips-n-Tricks, Howtos, & Docs / Howto: Building Flash Code for Linux x64 architecture; Ubuntu AMD64
Post New Reply 
Threaded Mode | Linear Mode
Howto: Building Flash Code for Linux x64 architecture; Ubuntu AMD64
04-04-2009, 01:10 PM (This post was last modified: 04-04-2009 08:45 PM by continuum.)
Post: 1
Alexvader2 Offline
Junior
Posts: 33
Joined: Mar 2009
Hi forum

I have successfully compiled Flash Code, http://flash.uchicago.edu/website/home/ , to run under Ubuntu 8.10AMD64;
Followed this howto : http://www.astro.sunysb.edu/mzingale/flash-fedora/
This app is mainly targeted to Unixes, running in BIG machines

I Included this here because this solved hot/dense plasma hydrodynamic problems, like supernovae Explosions, nuclear fusion burn/deflagration... it is a shock propagation code.

feel free to try this...
Best regards
Alex

Well here it goes :

You untar the package into /usr/local for instance... mine is
Code:
/usr/local/FLASH3.1

You install the packages that support message passing interface calculation in Ubuntu :libopenmpi, openmpi, python-mpi as well as the blacs-mpich packages, and the scalapack-mpich.

Then you cd to /usr/local/FLASH3.1 and

Code:
mkdir -p flash/source/sites/<your hostname>
cp flash/source/sites/Prototypes/Linux/Makefile.h flash/source/sites/<your hostname>

This way, you will have a default makefile associated with your computer configuration, now to edit that configuration :

Quote:# FLASH makefile definitions for ix86 Linux (Portland Group compiler)

# note, in order to get pgprof to work properly, it was necessary to
# download a new version from ftp://ftp.pgroup.com/ that plays nicely
# with GNOME.

#----------------------------------------------------------------------------
# Set the HDF/HDF5 library paths -- these need to be updated for your system
#----------------------------------------------------------------------------
HDF4_PATH = /usr/local/hdf4
HDF5_PATH = /opt/HDF5-1.4.2-patch1-serial/

ZLIB_PATH =

PAPI_PATH =
PAPI_FLAGS =

NCMPI_PATH =
MPE_PATH =

#----------------------------------------------------------------------------
# Compiler and linker commands
#
# Use the MPICH wrappers around the compilers -- these will automatically
# load the proper libraries and include files. Version of MPICH prior
# to 1.2.2 (?) do not recognize .F90 as a valid Fortran file extension.
# You need to edit mpif90 and add .F90 to the test of filename extensions,
# or upgrade your MPICH.
#----------------------------------------------------------------------------
###########################################################
FCOMP = mpif90.openmpi
###########################################################
CCOMP = mpicc.openmpi
###########################################################
CPPCOMP = mpiCC.openmpi
###########################################################
LINK = mpif90.openmpi
###########################################################

# pre-processor flag
PP = -D

#----------------------------------------------------------------------------
# Compilation flags
#
# Three sets of compilation/linking flags are defined: one for optimized
# code, one for testing, and one for debugging. The default is to use the
# _OPT version. Specifying -debug to setup will pick the _DEBUG version,
# these should enable bounds checking. Specifying _TEST is used for
# flash_test, and is set for quick code generation, and (sometimes)
# profiling. The Makefile generated by setup will assign the generic token
# (ex. FFLAGS) to the proper set of flags (ex. FFLAGS_OPT).
#----------------------------------------------------------------------------

########################################################
FFLAGS_OPT = -c -O2 -fdefault-real-8 -fdefault-double-8
FFLAGS_DEBUG = -g -c -fdefault-real-8 -fdefault-double-8
FFLAGS_TEST = -c -fdefault-real-8 -fdefault-double-8
########################################################

F90FLAGS =

CFLAGS_OPT = -O2 -c
CFLAGS_DEBUG = -g -c
CFLAGS_TEST = -c

# if we are using HDF5, we need to specify the path to the include files
CFLAGS_HDF5 = -I $(HDF5_PATH)/include

CFLAGS_NCMPI =

#----------------------------------------------------------------------------
# Linker flags
#
# There is a seperate version of the linker flags for each of the _OPT,
# _DEBUG, and _TEST cases.
#----------------------------------------------------------------------------

LFLAGS_OPT = -o
LFLAGS_DEBUG = -g -o
LFLAGS_TEST = -o


#----------------------------------------------------------------------------
# Library specific linking
#
# If a FLASH module has a 'LIBRARY xxx' line in its Config file, we need to
# create a macro in this Makefile.h for LIB_xxx, which will be added to the
# link line when FLASH is built. This allows us to switch between different
# (incompatible) libraries. We also create a _OPT, _DEBUG, and _TEST
# library macro to add any performance-minded libraries (like fast math),
# depending on how FLASH was setup.
#----------------------------------------------------------------------------

LIB_OPT =
LIB_DEBUG =
LIB_TEST =

LIB_HDF4 = -L $(HDF4_PATH)/lib -lmfhdf -ldf -ljpeg -lz
LIB_HDF5 = -L $(HDF5_PATH)/lib -lhdf5

LIB_PAPI =
LIB_MATH = -ldfftw -ldrfftw
LIB_NCMPI =
LIB_MPE =

#----------------------------------------------------------------------------
# Additional machine-dependent object files
#
# Add any machine specific files here -- they will be compiled and linked
# when FLASH is built.
#----------------------------------------------------------------------------

MACHOBJ =


#----------------------------------------------------------------------------
# Additional commands
#----------------------------------------------------------------------------

MV = mv -f
AR = ar -r
RM = rm -f
CD = cd
RL = ranlib
ECHO = echo


This is my edited Makefile.h that lives in
Quote:<FLASHDIR>/source/sites/<MyHostname>/

The parts that i edited are isolated with comment lines :FCOMP CCOMP CPPCOMP and LINK had to be changed from mpif90 to mpif90.openmpi, mpicc.openmpi, mpicc.openmpi, and mpif90.openmpi respectively.

The flag compiler options had to be set like the following :

Quote:########################################################
FFLAGS_OPT = -c -O2 -fdefault-real-8 -fdefault-double-8
FFLAGS_DEBUG = -g -c -fdefault-real-8 -fdefault-double-8
FFLAGS_TEST = -c -fdefault-real-8 -fdefault-double-8
########################################################

Now you only have to change some settings in formatting in some source .f90 :

Open checkpoint_wr.F90 in
Code:
FLASH3.1/source/io/amr/hdf5_serial/
and edit line 221:

Code:
write (num_to_str, '(I)') MAX_BLK_MSGS  to
Code:
write (num_to_str, '(I16.6)') MAX_BLK_MSGS

There is also another source file to edit, which carries the same bug... when you 'make' the build process will report you the name of that file and the very same bug : correct it the same way as for checkpoint_wr.F90.

Now you are ready to go :

Code:
cd /usr/local/<flashdir>
./setup <problem_name> -auto

problem_name lives inside one of the directories of /usr/local/<flashdir>/setups

This will create a makefile for your problem inside /usr/local/<flashdir>/objects;
type make;

If everything goes allright, by now you have an executable inside of objects called , (or flash_whatever); cd objects and edit flash.par ( this is not a cray-T3E you are using to run your problem... :-) ) and change lrefinemax to 7 ( steps of iterative mesh refinement in zones of high gradients )

You are set now: Type ./flash3, and it will create inside of objects a series of hdf5 files with the results of the simulation that you performed.

Now you will be able to extract useful information about that simulation.

Enjoy


PS I am now tryin to install fluka, http://www.fluka.org/fluka.php, so as to couple a multigroup neutron transport transient problem with a plasma being adiabatically compressed by a shock wave delivered by an inert material shell.

fluka is a more "civilized" ( or should i say civilian ...? :-) ) version of mcnp code mcnpx : http://mcnpx.lanl.gov/

Doesnt have the libraries of neutron transport cross sections for different materials, nor the opacity values for radiant transport... but with some little hacking and physics knowledge... you can work things out and simulate whatever they do not want you to... heheheheh :-D
Find 
Reply 
02-03-2010, 12:07 AM
Post: 2
kyjongl Offline
Junior
Posts: 27
Joined: Nov 2008
(04-04-2009 01:10 PM)Alexvader2 Wrote:  Hi forum

I have successfully compiled Flash Code, http://flash.uchicago.edu/website/home/ , to run under Ubuntu 8.10AMD64;
Followed this howto : http://www.astro.sunysb.edu/mzingale/flash-fedora/
This app is mainly targeted to Unixes, running in BIG machines

I Included this here because this solved hot/dense plasma hydrodynamic problems, like supernovae Explosions, nuclear fusion burn/deflagration... it is a shock propagation code.

feel free to try this...
Best regards
Alex

Well here it goes :

You untar the package into /usr/local for instance... mine is
Code:
/usr/local/FLASH3.1

You install the packages that support message passing interface calculation in Ubuntu :libopenmpi, openmpi, python-mpi as well as the blacs-mpich packages, and the scalapack-mpich.

Then you cd to /usr/local/FLASH3.1 and

Code:
mkdir -p flash/source/sites/<your hostname>
cp flash/source/sites/Prototypes/Linux/Makefile.h flash/source/sites/<your hostname>

This way, you will have a default makefile associated with your computer configuration, now to edit that configuration :

Quote:# FLASH makefile definitions for ix86 Linux (Portland Group compiler)

# note, in order to get pgprof to work properly, it was necessary to
# download a new version from ftp://ftp.pgroup.com/ that plays nicely
# with GNOME.

#----------------------------------------------------------------------------
# Set the HDF/HDF5 library paths -- these need to be updated for your system
#----------------------------------------------------------------------------
HDF4_PATH = /usr/local/hdf4
HDF5_PATH = /opt/HDF5-1.4.2-patch1-serial/

ZLIB_PATH =

PAPI_PATH =
PAPI_FLAGS =

NCMPI_PATH =
MPE_PATH =

#----------------------------------------------------------------------------
# Compiler and linker commands
#
# Use the MPICH wrappers around the compilers -- these will automatically
# load the proper libraries and include files. Version of MPICH prior
# to 1.2.2 (?) do not recognize .F90 as a valid Fortran file extension.
# You need to edit mpif90 and add .F90 to the test of filename extensions,
# or upgrade your MPICH.
#----------------------------------------------------------------------------
###########################################################
FCOMP = mpif90.openmpi
###########################################################
CCOMP = mpicc.openmpi
###########################################################
CPPCOMP = mpiCC.openmpi
###########################################################
LINK = mpif90.openmpi
###########################################################

# pre-processor flag
PP = -D

#----------------------------------------------------------------------------
# Compilation flags
#
# Three sets of compilation/linking flags are defined: one for optimized
# code, one for testing, and one for debugging. The default is to use the
# _OPT version. Specifying -debug to setup will pick the _DEBUG version,
# these should enable bounds checking. Specifying _TEST is used for
# flash_test, and is set for quick code generation, and (sometimes)
# profiling. The Makefile generated by setup will assign the generic token
# (ex. FFLAGS) to the proper set of flags (ex. FFLAGS_OPT).
#----------------------------------------------------------------------------

########################################################
FFLAGS_OPT = -c -O2 -fdefault-real-8 -fdefault-double-8
FFLAGS_DEBUG = -g -c -fdefault-real-8 -fdefault-double-8
FFLAGS_TEST = -c -fdefault-real-8 -fdefault-double-8
########################################################

F90FLAGS =

CFLAGS_OPT = -O2 -c
CFLAGS_DEBUG = -g -c
CFLAGS_TEST = -c

# if we are using HDF5, we need to specify the path to the include files
CFLAGS_HDF5 = -I $(HDF5_PATH)/include

CFLAGS_NCMPI =

#----------------------------------------------------------------------------
# Linker flags
#
# There is a seperate version of the linker flags for each of the _OPT,
# _DEBUG, and _TEST cases.
#----------------------------------------------------------------------------

LFLAGS_OPT = -o
LFLAGS_DEBUG = -g -o
LFLAGS_TEST = -o


#----------------------------------------------------------------------------
# Library specific linking
#
# If a FLASH module has a 'LIBRARY xxx' line in its Config file, we need to
# create a macro in this Makefile.h for LIB_xxx, which will be added to the
# link line when FLASH is built. This allows us to switch between different
# (incompatible) libraries. We also create a _OPT, _DEBUG, and _TEST
# library macro to add any performance-minded libraries (like fast math),
# depending on how FLASH was setup.
#----------------------------------------------------------------------------

LIB_OPT =
LIB_DEBUG =
LIB_TEST =

LIB_HDF4 = -L $(HDF4_PATH)/lib -lmfhdf -ldf -ljpeg -lz
LIB_HDF5 = -L $(HDF5_PATH)/lib -lhdf5

LIB_PAPI =
LIB_MATH = -ldfftw -ldrfftw
LIB_NCMPI =
LIB_MPE =

#----------------------------------------------------------------------------
# Additional machine-dependent object files
#
# Add any machine specific files here -- they will be compiled and linked
# when FLASH is built.
#----------------------------------------------------------------------------

MACHOBJ =


#----------------------------------------------------------------------------
# Additional commands
#----------------------------------------------------------------------------

MV = mv -f
AR = ar -r
RM = rm -f
CD = cd
RL = ranlib
ECHO = echo


This is my edited Makefile.h that lives in
Quote:<FLASHDIR>/source/sites/<MyHostname>/

The parts that i edited are isolated with comment lines :FCOMP CCOMP CPPCOMP and LINK had to be changed from mpif90 to mpif90.openmpi, mpicc.openmpi, mpicc.openmpi, and mpif90.openmpi respectively.

The flag compiler options had to be set like the following :

Quote:########################################################
FFLAGS_OPT = -c -O2 -fdefault-real-8 -fdefault-double-8
FFLAGS_DEBUG = -g -c -fdefault-real-8 -fdefault-double-8
FFLAGS_TEST = -c -fdefault-real-8 -fdefault-double-8
########################################################

Now you only have to change some settings in formatting in some source .f90 :

Open checkpoint_wr.F90 in
Code:
FLASH3.1/source/io/amr/hdf5_serial/
and edit line 221:

Code:
write (num_to_str, '(I)') MAX_BLK_MSGS  to
Code:
write (num_to_str, '(I16.6)') MAX_BLK_MSGS

There is also another source file to edit, which carries the same bug... when you 'make' the build process will report you the name of that file and the very same bug : correct it the same way as for checkpoint_wr.F90.

Now you are ready to go :

Code:
cd /usr/local/<flashdir>
./setup <problem_name> -auto

problem_name lives inside one of the directories of /usr/local/<flashdir>/setups

This will create a makefile for your problem inside /usr/local/<flashdir>/objects;
type make;

If everything goes allright, by now you have an executable inside of objects called , (or flash_whatever); cd objects and edit flash.par ( this is not a cray-T3E you are using to run your problem... :-) ) and change lrefinemax to 7 ( steps of iterative mesh refinement in zones of high gradients )

You are set now: Type ./flash3, and it will create inside of objects a series of hdf5 files with the results of the simulation that you performed.

Now you will be able to extract useful information about that simulation.

Enjoy


PS I am now tryin to install fluka, http://www.fluka.org/fluka.php, so as to couple a multigroup neutron transport transient problem with a plasma being adiabatically compressed by a shock wave delivered by an inert material shell.

fluka is a more "civilized" ( or should i say civilian ...? :-) ) version of mcnp code mcnpx : http://mcnpx.lanl.gov/

Doesnt have the libraries of neutron transport cross sections for different materials, nor the opacity values for radiant transport... but with some little hacking and physics knowledge... you can work things out and simulate whatever they do not want you to... heheheheh :-D


Thanks.
Could you please write one for CentOS systems?
I tried to compile flash. I do not know whether I even need this.
Heard of MayaVi ?

Check it out. Heard a lot of good things about it Smile
Find 
Reply 
« Next Oldest | Next Newest »
Post New Reply 


[-]
Quick Reply
Message
Type your reply to this message here.


You have selected one or more posts to quote. Quote these posts now or deselect them.
Image Verification
Image Verification
(case insensitive)
Please enter the text within the image on the left in to the text box below. This process is used to prevent automated posts.

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Howto:Rdesktop & VPN. Linux->Windows kinematic 0 104 07-17-2010 11:07 AM
Last Post: kinematic
Lightbulb How to install Abaqus 6.8 in linux continuum 25 7,478 12-23-2009 02:16 AM
Last Post: kinematic
  How to install matlab student R14 v7 in linux continuum 0 393 03-28-2009 04:45 PM
Last Post: continuum
  Howto: Continuum shell stacking direction on cylindrical solid composite section continuum 5 885 02-01-2009 09:54 PM
Last Post: continuum

  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread

Contact Us | Home | Forums | Return to Top | Lite (Archive) Mode | RSS Syndication

Powered By MyBB, © 2002-2010 MyBB Group | © 2010 CAE Journal (Computer Aided Engineering Journal)
Product names and trademarks are the property of the respective trademark holders.
None of the trademark holders listed are affiliated with this website or forum.
No endorsement of any information, service or product by any company or person is made or implied.