************************************************************************** ************************************************************************** Compilation and Installation of LibMultiScale and its external libraries. ************************************************************************** ************************************************************************** The installation is decomposed in two stages : - installation of the dependencies (I to IV) - installation of libMultiScale ************************************************************************** Compilation and Installation the externals. ************************************************************************** I) Dependencies The number of dependencies to LibMultiScale is given by the following list: - MPI (mandatory) - LIBMESH (0.5.0) -PETSc (2.3.2) - BLAS and LAPACK - LAMMPS - FFTW (version 2.5) - STAMP (v2) - NETCDF - ZLIB (optional but usefull) II) Download the externals The users are invited to consult the list of already compiled externals on the INRIA gforge site. The users should try this procedure only if the architecture, or BLAS, or MPI implementation do not fit your computer. If you found one binary package for you, you can jump to the section IV) If it is the case you can download the file 'libmultiscale-externals.tar.gz' in the download page http://gforge.inria.fr/projects/libmultiscale/ from the package external-compile-tools. Then you have to extract this archive. In the directory uncompressed you may find the script 'download-externals.sh' to download the dependencies needed for compiling the externals. MPI won't be downloaded, and the part concerning complete installation of MPI is at the charge of the user. Then you can follow sequentially the procedure. III) Compilation of externals a) Compilation of PETSc PETSc is essential for the use of libmesh plugin into LibMultiScale. At this point the user should have chosen the BLAS/LAPACK implementation and MPI implementation that is wanted to be used. They should also be installed. The download script offer you to download ATLAS implementation. It is up to you to configure, compile and install it correctly. This part is left to the user in order to let him compile the LibMultiScale against others implementations. Then one can refer to the compilation process given on the page http://www-unix.mcs.anl.gov/petsc/petsc-as/documentation/installation.html to have a functional PETSc installation. We want here to put ahead some important points : - The following options should be used at the configure step : "--with-debugging=no --with-shared=0 --with-mpi --with-x=0" - PETSC_DIR and PETSC_ARCH environment variables should be correctly set before going to the next steps. - PETSc MUST have MPI support enabled to get linked with LibMultiScale with parallelism support. This is MANDATORY ! b) Compilation of the other packages You can use the configure script and follow instructions for installing the externals. You may configure and compile by yourself LibMesh, Lammps, FFTW. But Lammps and LibMesh need to be patched, by use of the patches in the patch directory. It is recommended to use the configure script for novice users but still you can follow the following procedure. c) extraction and patch of the other packages First you have to extract the archives downloaded : cd external tar xfz libmesh-0.5.0.tar.gz tar xfz lammps.tar.gz tar xfz fftw-2.1.5.tar.gz Then you patch Lammps and LibMesh by application of the patches : patch -N -p0 < ../patches/lammps.patch patch -N -p0 < ../patches/libmesh-0.5.0.patch And finally you have to compile each of them d) Compilation of LibMesh cd libmesh-0.5.0 ./configure --disable-triangle --enable-mpi --disable-tecplot The configuration process is important, and you have to check in the file config.log that PETSc has been found and MPI is well activated. Then you can hit : make e) Compilation of Lammps cd lammps/src/ You may take a look to the file lammps/src/MAKE/Makefile.liberty and edit the configuration for fftw and compilers with MPI support (mpicc, mpcc...) which are essential for a complete compilation. Then a : make liberty Should issue the creation of a libLammps.so that is required to use Lammps plugins. d) Compilation of FFTW quite simple, and without any dependencies. cd fftw-2.1.5/ ./configure make ************************************************************************** Compilation and Installation of LibMultiScale and AMEL. ************************************************************************** IV) Downloading LibMultiScale You can take a release of the source at the page : http://gforge.inria.fr/frs/?group_id=915 Or you can have the svn trunk by typing : svn checkout svn://scm.gforge.inria.fr/svn/libmultiscale V) Configuration of LibMultiScale There is two way of configuring LibMultiScale to find the externals. - First one is by using a binary package containing the externals. Such packages are available at the download page : http://gforge.inria.fr/projects/libmultiscale/ You need to choose a package in concordance to your architecture and to the MPI version you have on your computer. You need to extract the archive to some chosen place. For example it could be : tar xfz externals-libmesh-mkl-lam.tgz For an external binary compile against LAM/MPI and with MKL Intel BLAS included. - The second strategy is used when you didn't find a valid binary package for externals. Then you surely proceded the section III and obtained an external directory filled with configured libraries. The configuration is then performed by cmake. To do so, you first have to create a directory where you want LibMultiScale to be built. mkdir build-libmultiscale cd build-libmultiscale Then you launch the cmake utility to configure the project : ccmake LIBMULTISCALE_SOURCES/src where LIBMULTISCALE_SOURCES is the directory where you placed the chosen release. Then first you have to turn off SEQUENTIAL option before you continue the configuration. - In the first case of installation of the externals, in the cmake interface you have to specify the directory where you extracted the package in var EXTERNALS. - In the second case, you have to specify the variables : PETSC_DIR and PETSC_ARCH with the directory where PETSc was installed and architecture. If you don't know the arch compiled for PETSc, hitting "c" will issue a message that notifies the possible archs. You have to pick one that is yours (example linux-gnu) !! Then you need to specify LIBMESH_DIR and LIBMESH_ARCH the same way you did for PETSC. ****************************************************************************** To finish the process, do not forget to activate Lammps support, or Zlib support if you want so. If you did not do that, you won't be able to run lammps modules. Also, if libmesh has been linked against zlib, not using it will probably issue a linkage error ****************************************************************************** Then you can hit "c" to configure and then "g" to generate makefiles. Sometimes it might be necessary to specify the MPI information as stated by cmake. (In most of the case, if you don't know the parameters needed for MPI to compile, you can use the command "mpicc -show". Thus it may be possible that MPI_EXTRA_LIBRARY should stay empty) VI) Compilation of LibMultiScale and AMEL Compilation will produce LibMultiScale libraries, plugins selected and the executable AMEL. AMEL states for "Atomistic Multi-domain coupling with External finite elements for LibMultiScale" and is basically a client end program for the LibMultiScale. Once all has gone well for the configuration process, you hit : make or eventually make -j nb_procs if you can use more than 1 processor to compile. And you should get LibMultiScale libraries built and AMEL executable in amel directory. You can install it by using "make install", which will copy the libraries and executable in the directory specified by the cmake var "CMAKE_INSTALL_PREFIX". VII) Testing AMEL program A set of examples is present into the directory 'examples'. You can test the examples by the following command: cd examples/Argon/2D mkdir ../analysis mpirun -np 1 ${INSTALL_DIR}/AMEL casCustom.lammps 100 Which should work properly. If not, please consult the forums of the project (http://gforge.inria.fr/forum/?group_id=915) to ask some help. ************************************************************************** Contributing to the LibMultiScale externals binary list ************************************************************************** VIII) Creation of a binary sample for your architecture If you proceded to a complete compilation, externals and LibMultiScale, you might contribute to the binary pool that is provided. You create a directory that will contain your binaries and includes needed for compilation. For example in the case of MKL blas and mpich2 MPI you might do : mkdir LM-externals-mkl-mpich2 cd LM-externals-mkl-mpich2 mkdir lib;mkdir include; You know copy all the libraries from petsc, libmesh, lammps to the directory lib. For instance : cp compiled_externals/external/petsc/lib/${ARCH_PETSC}/*.a lib/ cp compiled_externals/external/libmesh/lib/${ARCH_LIBMESH}/libmesh.a lib/ cp compiled_externals/external/petsc/contrib/lib/${ARCH_LIBMESH}/lib/*.a lib/ cp compiled_externals/external/lammps/src/libLammps.so lib/ Then you have to copy the include files : mkdir include/petsc cp -r compiled_externals/external/petsc/include/* include/petsc cp compiled_externals/external/petsc/bmake/${PETSC_ARCH}/*.h include/petsc cp compiled_externals/external/petsc/bmake/${PETSC_ARCH}/petscconf include/petsc cp -r compiled_externals/external/libmesh/include/* include/libmesh/ cp compiled_externals/external/lammps/src/*.h include/lammps/ You know have to clear the entry of SL_LINKER_LIBS of all local configuration in the file include/petsc/petscconf. You know have to find by yourself the additional libraries to copy. You have to think of the BLAS that you linked with petsc. you copy them to the directory lib/. You can have a functional gcc option line by the variable BLASLAPACK_LIB defined in file include/petsc/petscconf. In order to get sure that everything will go well you can use the tool "ldd" onto the file src/amel/AMEL and check that every shared library that was linked is present in directory lib/. The only that is required not to include are MPI include files or MPI libraries. !!!! When all is done and eventually tested, you clean the permissions by find . -type f -exec chmod a-x '{}' ';' find . -type f -exec chmod a-w '{}' ';' and you can make a tar archive and submit it at the address anciaux@labri.fr or coulaud@labri.fr. Thanks for contributing !