PageRenderTime 51ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/doc/manual/source/tutorials/building_enzo.rst

https://bitbucket.org/enzo/enzo-dev/
ReStructuredText | 363 lines | 268 code | 95 blank | 0 comment | 0 complexity | 4023c6025c7afc151909150dd42107ff MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.1, GPL-2.0
  1. .. _obtaining_and_building_enzo:
  2. Obtaining and Building Enzo
  3. ===========================
  4. .. _CompilationRequirements:
  5. Enzo Compilation Requirements
  6. -----------------------------
  7. Enzo can be compiled on any POSIX-compatible operating system, such as Linux,
  8. BSD (including Mac OS X), and AIX. In addition to a C/C++ and Fortran-90
  9. compiler, the following libraries are necessary:
  10. * `HDF5 <http://www.hdfgroup.org/HDF5/>`_, the hierarchical data format.
  11. Note that HDF5 also may require the szip and zlib libraries, which can be
  12. found at the HDF5 website. Note that compiling with HDF5 1.8 or greater
  13. requires that the compiler directive ``H5_USE_16_API`` be specified;
  14. typically this is done with ``-DH5_USE_16_API`` and it's set in most of
  15. the provided makefiles.
  16. * `MPI <http://www.mcs.anl.gov/research/projects/mpi/>`_, for multi-processor parallel
  17. jobs. Note that Enzo will compile without MPI, but it's fine to compile
  18. with MPI and only run on a single processor.
  19. * `yt <http://yt-project.org>`_, the yt visualization and analysis suite.
  20. While it is not required to run enzo, ``yt`` enables the easiest analysis
  21. of its outputs, as well as the ability to run the enzo testing tools. It
  22. also provides an easy way to download enzo as part of its installation script.
  23. See the `Enzo Project home page <http://enzo-project.org/>`_ for more
  24. information.
  25. Downloading Enzo
  26. ----------------
  27. We encourage anyone who uses Enzo to sign up for the `Enzo Users'
  28. List <http://groups.google.com/group/enzo-users>`_, where one can ask questions
  29. to the community of enzo users and developers.
  30. Please visit the `Enzo Project home page <http://enzo-project.org>`_ to learn
  31. more about the code and different installation methods. To directly access the source
  32. code, you can visit the `Enzo Bitbucket page <https://bitbucket.org/enzo>`_.
  33. If you already have Fortran, C, C++ compilers,
  34. `Mercurial <http://mercurial.selenic.com>`_,
  35. `MPI <http://www.mcs.anl.gov/research/projects/mpi/>`_, and
  36. `HDF5 <http://www.hdfgroup.org/HDF5/>`_ installed, then installation of
  37. Enzo should be straightforward. Simply run the following at the command line
  38. to get the latest stable version of the Enzo source using Mercurial. This
  39. command makes a copy of the existing enzo source code repository on your local
  40. computer in the current directory:
  41. .. highlight:: none
  42. ::
  43. ~ $ hg clone https://bitbucket.org/enzo/enzo-dev ./enzo
  44. Later on, if you want to update your code and get any additional modifications
  45. which may have occurred since you originally cloned the source repository,
  46. you will have to ``pull`` them from the server and then ``update`` your
  47. local copy (in this example, no new changes have occurred):
  48. By default, after you clone enzo you will be on the ``stable`` branch. If you
  49. wish to use the latest development version, you must update to the
  50. ``week-of-code`` branch:
  51. .. highlight:: none
  52. ::
  53. ~/enzo $ hg update week-of-code
  54. .. highlight:: none
  55. ::
  56. ~/enzo $ cd enzo
  57. ~/enzo $ hg pull
  58. pulling from https://bitbucket.org/enzo/enzo-dev
  59. searching for changes
  60. no changes found
  61. ~/enzo $ hg update
  62. 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  63. ~/enzo $
  64. This covers the basics, but for more information about interacting with the
  65. mercurial version control system please peruse the :ref:`developers_guide`,
  66. the `Mercurial Documentation <http://mercurial.selenic.com/>`_, and/or
  67. this entertaining `tutorial on Mercurial <http://hginit.com>`_.
  68. Building Enzo
  69. -------------
  70. This is a quick, line by line example for building
  71. Enzo using the current build system. A comprehensive list of the make
  72. system arguments can be found in :ref:`MakeOptions`.
  73. This assumes that we're working from a checkout (or download) of the source
  74. after following instructions on the `Enzo Project home page <http://enzo-project.org>`_, or the instructions in the last section. For more detailed information
  75. about the structure of the Enzo source control repository, see
  76. :ref:`enzo_modification`.
  77. Initializing the Build System
  78. +++++++++++++++++++++++++++++
  79. This just clears any existing configurations left over from a previous machine,
  80. and creates a couple of files for building.
  81. ::
  82. ~ $ cd enzo/
  83. ~/enzo $ ./configure
  84. Configure complete.
  85. ~/enzo $
  86. This message just confirms that the build system has been
  87. initialized. To further confirm that it ran, there should be a file called
  88. Make.config.machine in the src/enzo subdirectory.
  89. Go to the Source Directory
  90. ++++++++++++++++++++++++++
  91. The source code for the various Enzo components are laid out in the
  92. src/ directory.
  93. ::
  94. ~/enzo $ cd src
  95. ~/enzo/src $ ls
  96. Makefile P-GroupFinder TREECOOL anyl enzo enzohop
  97. inits lcaperf mpgrafic performance_tools ring
  98. ~/enzo/src $
  99. Right now, we're just building the main executable (the one that
  100. does the simulations), so we need the ``enzo/`` directory.
  101. ::
  102. ~/enzo/src $ cd enzo/
  103. Find the Right Machine File
  104. +++++++++++++++++++++++++++
  105. We've chosen to go with configurations files based on specific
  106. machines. This means we can provide configurations files for most
  107. of the major NSF resources, and examples for many of the one-off
  108. (clusters, laptops, etc.).
  109. These machine-specific configuration files are named ``Make.mach.machinename``.
  110. ::
  111. ~/enzo/src/enzo $ ls Make.mach.*
  112. Make.mach.arizona Make.mach.darwin
  113. Make.mach.hotfoot-condor Make.mach.kolob
  114. Make.mach.linux-gnu Make.mach.nasa-discover
  115. Make.mach.nasa-pleiades Make.mach.ncsa-bluedrop
  116. Make.mach.ncsa-bluewaters-gnu Make.mach.ncsa-cobalt
  117. Make.mach.nics-kraken Make.mach.nics-kraken-gnu
  118. Make.mach.nics-kraken-gnu-yt Make.mach.nics-nautilus
  119. Make.mach.orange Make.mach.ornl-jaguar-pgi
  120. Make.mach.scinet Make.mach.sunnyvale
  121. Make.mach.tacc-ranger Make.mach.trestles
  122. Make.mach.triton Make.mach.triton-gnu
  123. Make.mach.triton-intel Make.mach.unknown
  124. ~/enzo/src/enzo $
  125. In this example, we choose ``Make.mach.darwin``, which is appropriate for Mac
  126. OS X machines.
  127. Porting
  128. +++++++
  129. If there's no machine file for the machine you're on, you will have
  130. to do a small amount of porting. However, we have attempted to
  131. provide a wide base of Makefiles, so you should be able to find one
  132. that is close, if not identical, to the machine you are attempting
  133. to run Enzo on. The basic steps are as follows:
  134. #. Find a Make.mach file from a similar platform.
  135. #. Copy it to Make.mach.site-machinename (site = sdsc or owner,
  136. machinename = hostname).
  137. #. Edit the machine-specific settings (compilers, libraries, etc.).
  138. #. Build and test.
  139. If you expect that you will have multiple checkouts of the Enzo source code,
  140. you should feel free to create the directory $HOME/.enzo/ and place your custom
  141. makefiles there, and Enzo's build system will use any machine name-matching
  142. Makefile in that directory to provide or override Make settings.
  143. Make sure you save your configuration file! If you're on a big system (multiple
  144. Enzo users), please post your file to `the Enzo mailing list
  145. <http://groups.google.com/group/enzo-users>`_, and it will be
  146. considered for inclusion with the base Enzo distribution.
  147. HDF5 Versions
  148. +++++++++++++
  149. If your system uses a version of HDF5 greater than or equal to 1.8, you
  150. probably need to add a flag to your compile settings, unless your HDF5 library
  151. was compiled using --with-default-api-version=v16. The simplest thing to do is
  152. to find the line in your Make.mach file that sets up MACH_DEFINES, which may
  153. look like this
  154. ::
  155. MACH_DEFINES = -DLINUX # Defines for the architecture; e.g. -DSUN, -DLINUX, etc.
  156. and change it to
  157. ::
  158. MACH_DEFINES = -DLINUX -DH5_USE_16_API # Defines for the architecture; e.g. -DSUN, -DLINUX, etc.
  159. This will ensure that the HDF5 header files expose the correct API
  160. for Enzo.
  161. Build the Makefile
  162. ++++++++++++++++++
  163. Now that you have your configuration file, tell the build system to
  164. use it (remember to ``make clean`` if you change any previous settings):
  165. ::
  166. ~/enzo/src/enzo $ make machine-darwin
  167. *** Execute 'gmake clean' before rebuilding executables ***
  168. MACHINE: Darwin (OSX Leopard)
  169. ~/enzo/src/enzo $
  170. You may also want to know the settings (precision, etc.) that are being
  171. use. You can find this out using ``make show-config``. For a detailed
  172. explanation of what these mean, see :ref:`MakeOptions`.
  173. ::
  174. ~/enzo/src/enzo $ make show-config
  175. MACHINE: Darwin (OSX Leopard)
  176. MACHINE-NAME: darwin
  177. PARAMETER_MAX_SUBGRIDS [max-subgrids-###] : 100000
  178. PARAMETER_MAX_BARYONS [max-baryons-###] : 30
  179. PARAMETER_MAX_TASKS_PER_NODE [max-tasks-per-node-###] : 8
  180. PARAMETER_MEMORY_POOL_SIZE [memory-pool-###] : 100000
  181. CONFIG_PRECISION [precision-{32,64}] : 64
  182. CONFIG_PARTICLES [particles-{32,64,128}] : 64
  183. CONFIG_INTEGERS [integers-{32,64}] : 64
  184. CONFIG_PARTICLE_IDS [particle-id-{32,64}] : 64
  185. CONFIG_INITS [inits-{32,64}] : 64
  186. CONFIG_IO [io-{32,64}] : 32
  187. CONFIG_USE_MPI [use-mpi-{yes,no}] : yes
  188. CONFIG_OBJECT_MODE [object-mode-{32,64}] : 64
  189. CONFIG_TASKMAP [taskmap-{yes,no}] : no
  190. CONFIG_PACKED_AMR [packed-amr-{yes,no}] : yes
  191. CONFIG_PACKED_MEM [packed-mem-{yes,no}] : no
  192. CONFIG_LCAPERF [lcaperf-{yes,no}] : no
  193. CONFIG_PAPI [papi-{yes,no}] : no
  194. CONFIG_PYTHON [python-{yes,no}] : no
  195. CONFIG_NEW_PROBLEM_TYPES [new-problem-types-{yes,no}] : no
  196. CONFIG_ECUDA [cuda-{yes,no}] : no
  197. CONFIG_OOC_BOUNDARY [ooc-boundary-{yes,no}] : no
  198. CONFIG_ACCELERATION_BOUNDARY [acceleration-boundary-{yes,no}] : yes
  199. CONFIG_OPT [opt-{warn,debug,cudadebug,high,aggressive}] : debug
  200. CONFIG_TESTING [testing-{yes,no}] : no
  201. CONFIG_TPVEL [tpvel-{yes,no}]] : no
  202. CONFIG_PHOTON [photon-{yes,no}] : yes
  203. CONFIG_HYPRE [hypre-{yes,no}] : no
  204. CONFIG_EMISSIVITY [emissivity-{yes,no}] : no
  205. CONFIG_USE_HDF4 [use-hdf4-{yes,no}] : no
  206. CONFIG_NEW_GRID_IO [newgridio-{yes,no}] : yes
  207. CONFIG_BITWISE_IDENTICALITY [bitwise-{yes,no}] : no
  208. CONFIG_FAST_SIB [fastsib-{yes,no}] : yes
  209. CONFIG_FLUX_FIX [fluxfix-{yes,no}] : yes
  210. CONFIG_GRAVITY_4S [gravity-4s-{yes,no}] : no
  211. CONFIG_ENZO_PERFORMANCE [enzo-performance-{yes,no}] : yes
  212. CONFIG_LOG2ALLOC [log2alloc-{yes,no}] : yes
  213. ~/enzo/src/enzo $
  214. Build Enzo
  215. ++++++++++
  216. The default build target is the main executable, Enzo.
  217. ::
  218. ~/enzo/src/enzo $ make
  219. Updating DEPEND
  220. pdating DEPEND
  221. Compiling enzo.C
  222. Compiling acml_st1.src
  223. ... (skipping) ...
  224. Compiling Zeus_zTransport.C
  225. Linking
  226. Success!
  227. ~/enzo/src/enzo $
  228. After compiling, you will have ``enzo.exe`` in the current directory.
  229. If you have a failure during the compiler process, you may get enough of
  230. an error message to track down what was responsible. If there is a failure
  231. during linking, examine the ``compile.out`` file to learn more about
  232. what caused the problem. A common problem is that you forgot to include the
  233. current location of the HDF5 libraries in your machine-specific makefile.
  234. Building other Tools
  235. ++++++++++++++++++++
  236. Building other tools is typically very straightforward; they rely on the same
  237. Makefiles, and so should require no porting or modifications to configuration.
  238. Inits
  239. ~~~~~
  240. ::
  241. ~/enzo/src/ring $ cd ../inits/
  242. ~/enzo/src/inits $ make
  243. Compiling enzo_module.src90
  244. Updating DEPEND
  245. Compiling acml_st1.src
  246. ...
  247. Compiling XChunk_WriteIntField.C
  248. Linking
  249. Success!
  250. This will produce ``inits.exe``.
  251. Ring
  252. ~~~~
  253. ::
  254. ~/enzo/src/enzo $ cd ../ring/
  255. ~/enzo/src/ring $ make
  256. Updating DEPEND
  257. Compiling Ring_Decomp.C
  258. Compiling Enzo_Dims_create.C
  259. Compiling Mpich_V1_Dims_create.c
  260. Linking
  261. Success!
  262. This will produce ``ring.exe``.
  263. .. _build_yt:
  264. YT
  265. ~~
  266. To install yt, you can use the installation script provided with the yt source
  267. distribution. See `the yt homepage <http://yt.enzotools.org/>`_ for more
  268. information.