|
|
(81 intermediate revisions by 4 users not shown) |
Line 1: |
Line 1: |
− | <span style="color:red">This page is being edited and some content may be inaccurate.</span>
| + | The information in this page was moved to GitHub: https://github.com/KratosMultiphysics/Kratos/wiki/Windows-Install |
− | | + | |
− | = How to compile Kratos: Windows Automatic =
| + | |
− | | + | |
− | If you already have VisualStudio 2010 or 2012 in your system, there are a couple of automatic compiler/installer both for 32 and 64 bits that will set up all the libraries required by Kratos and perform the compilation process automatically. The process is fully automated and you will only have to specify the install directory and click "next" You can found the installers here:
| + | |
− |
| + | |
− | '''For 32 Bits:'''
| + | |
− | https://web.cimne.upc.edu/users/croig/data/kratos-3.3.dev-win-32.exe
| + | |
− | | + | |
− | '''For 64 Bits:'''
| + | |
− | https://web.cimne.upc.edu/users/croig/data/kratos-4.0.dev-win-64.exe
| + | |
− | | + | |
− | After using these installers you will have the last version available in the repository compiled.
| + | |
− | | + | |
− | Notice that these installers will overwrite any previous version of the prerequisite libraries on your machine. The complete list of the libraries installed is the following:
| + | |
− | | + | |
− | * Python 3.3
| + | |
− | * Svn 1.8.0.1
| + | |
− | * CMake 3.0.2
| + | |
− | * ACML 4.4
| + | |
− | = How to compile Kratos: Windows Manual =
| + | |
− | | + | |
− | In this section we are going to go through the process of compiling a basic version of Kratos Multiphysics under Windows environments. Specifically, we explain how to compile Kratos in:
| + | |
− | | + | |
− | * Windows 7
| + | |
− | * Windows 10
| + | |
− | | + | |
− | We do not recommend, but is also valid for:
| + | |
− | | + | |
− | * Windows 8
| + | |
− | * Windows 8.1
| + | |
− | | + | |
− | A basic knowledge of Windows is assumed ( execute commands in cmd, create directories, etc...)
| + | |
− | | + | |
− | If you are not familiar with the following concepts listed below, please take fife minutes read the windows basic section (TODO).
| + | |
− | | + | |
− | == Visual Studio ==
| + | |
− | | + | |
− | Visual studio is the only compiler officially supported to build Kratos under Windows.
| + | |
− | We recommend you to download the most recent version of visual studio. Although, a list of the known working versions is presented here ( Professional variants also work):
| + | |
− | | + | |
− | VisualStudio 2015 Community: https://www.microsoft.com/en-US/download/details.aspx?id=48146
| + | |
− | VisualStudio 2013 Community: https://www.microsoft.com/en-US/download/details.aspx?id=44914
| + | |
− | VisualStudio 2012 Express : https://www.microsoft.com/en-US/download/details.aspx?id=34673
| + | |
− | | + | |
− | Please notice that if you want OpenMP support you must download a Community version or Professional version. Express version do not have support for OpenMP
| + | |
− | | + | |
− | == Subversion ==
| + | |
− | | + | |
− | * Objectives:
| + | |
− | ** Install subversion
| + | |
− | ** Get Kratos Multiphysics source code
| + | |
− | | + | |
− | The first thing you will need is the Kratos Multiphysics source code. To download the code you will have to use a subversion manager. You can install a default subversion manager from the link below. Please, notice that if you install a different svn manager you may need to add it to the system
| + | |
− | path. The suggested manager is the official svn client, which you can download here:
| + | |
− | | + | |
− | https://sourceforge.net/projects/win32svn/
| + | |
− | | + | |
− | Once subversion is installed you can fetch the code by executing the command below in the command line:
| + | |
− | | + | |
− | svn co https://svn.cimne.upc.edu/p/kratos/kratos .
| + | |
− | | + | |
− | Once this is done, you should have a "kratos" directory containing Kratos soruces
| + | |
− | | + | |
− | == CMake ==
| + | |
− | | + | |
− | * Objectives:
| + | |
− | ** Install CMake
| + | |
− | | + | |
− | Cmake is the tool used to compile kratos. You can obtain it from its official webpage.
| + | |
− | | + | |
− | https://cmake.org/download/
| + | |
− | | + | |
− | Once installing, please <span style="color:red"> do not forget to mark the option: '''"Add CMake to the system PATH for all users"'''</span>
| + | |
− | | + | |
− | Please notice that if you want to use python 3.4 or higher, you will need CMake 3.0.2 or higher.
| + | |
− | | + | |
− | == Python ==
| + | |
− | | + | |
− | * Objectives:
| + | |
− | ** Install Python3
| + | |
− | | + | |
− | You will need any version of python in your computer in order to compile Kratos. We strongly recommend Python 3, at least 3.3.4 or higher. you can download python from its official webpage:
| + | |
− | | + | |
− | https://www.python.org/downloads/
| + | |
− | | + | |
− | Please, take special care to download a installer that suits your desired architecture <span style="color:red">x86 for 32 bits</span> compilations and <span style="color:red">x86_64 for 64 bits</span> compilations. Otherwise it won't work.
| + | |
− | | + | |
− | == BLAS and LAPACK ==
| + | |
− | | + | |
− | * Objectives:
| + | |
− | ** Get LIBBLAS and LIBLAPACK
| + | |
− | | + | |
− | Blas and Lapack are needed for many solvers, specially those present in the ExternalSolvers Application, that you will likely need to compile. You can get these libraries from:
| + | |
− | | + | |
− | https://icl.cs.utk.edu/lapack-for-windows/lapack/
| + | |
− | | + | |
− | Under the section: '''"Prebuilt libraries for Microsoft Visual Studio Projects"'''. Please download both dll and lib files for your architecture.
| + | |
− | | + | |
− | | + | |
− | Additionally, you will need some extra dependencies for these libs. The easiest way to fulfil them is to install a proper version of MinGW in your system (32 or 64). Any distribution should work, you can find one here:
| + | |
− | | + | |
− | https://sourceforge.net/projects/mingw-w64/
| + | |
− | | + | |
− | Again please take special care to select the correct architecture during the installation.
| + | |
− | | + | |
− | == Boost ==
| + | |
− | | + | |
− | * Objectives:
| + | |
− | ** Compile boost libraries
| + | |
− | | + | |
− | The next step will consist in compile Boost. Kratos Multiphysics needs Boost libraries to support some of its functions. You can use any version from '''version 1.54''' onwards, please notice that <span style="color:red">'''version 1.60 is not supported'''</span> due to a bug with python wrappers. It's very important to add the correct path to the boost library in the configure.bat, see more below. You can download boost from its official website:
| + | |
− | | + | |
− | http://www.boost.org/users/download/
| + | |
− | | + | |
− | Extract boost, navigate to the directory and execute this command:
| + | |
− | | + | |
− | bootstrap
| + | |
− | | + | |
− | Some additional files will be generated.
| + | |
− | | + | |
− | By default, boost will try to link with python 2.7. '''It is important to manually specify that we want to use python 3 by adding your downloaded python version. For example, if you have python 3.3.4 you should add “using python : 3.3 : /usr ;”''' to the file project-config.jam:
| + | |
− | | + | |
− | '''For 32 bits:'''
| + | |
− | using python : 3.3 : C:\\Python33\\python ;
| + | |
− | | + | |
− | '''For 64 bits:'''
| + | |
− | using python : 3.3 : C:\\Python33\\python : : : <address-model>64 ;
| + | |
− | | + | |
− | After modifying it you will have to compile the required boost libraries using the command below. Notice that this will only compile “serialization” and “python” libraries. If you need further libraries, you will need to explicitly tell boost to compile them.
| + | |
− | You need to know which version of msvc you are using:
| + | |
− | | + | |
− | Visual studio 2015: <span style="color: red">--toolset=msvc-14.0</span><br>
| + | |
− | Visual studio 2013: <span style="color: red">--toolset=msvc-12.0</span><br>
| + | |
− | Visual studio 2012: <span style="color: red">--toolset=msvc-11.0</span><br>
| + | |
− | Visual studio 2010: <span style="color: red">--toolset=msvc-10.0</span><br>
| + | |
− | | + | |
− | '''For 32 bits:'''
| + | |
− | b2 <span style="color: red">--toolset=msvc-14.0</span> --build-type=complete architecture=x86 stage --with-python --with-serialization variant=release link=shared,static
| + | |
− | | + | |
− | '''For 64 bits:'''
| + | |
− | b2 <span style="color: red">--toolset=msvc-14.0</span> --build-type=complete architecture=x86 address-model=64 stage --with-python --with-serialization variant=release link=shared,static
| + | |
− | | + | |
− | == Compiling Kratos ==
| + | |
− | | + | |
− | === Customize configure.bat ===
| + | |
− | | + | |
− | * Objectives:
| + | |
− | ** Prepare Kratos configuration file
| + | |
− | | + | |
− | In the Kratos root folder ("'''C:\kratos\cmake_build'''") copy the '''example_configure.bat.do_not_touch''' to '''configure.bat'''.
| + | |
− | This file controls where Kratos is going to search for the libraries, which applications are going to be installed and how the visual studio solution is going to be generated, among other things.
| + | |
− | | + | |
− | ==== Set the Generator ====
| + | |
− | | + | |
− | The first thing you need to do is to tell CMake that you intend to build a VisualStudio project. This is done automatically by CMake, but is highly recommended to add it yourself. To do it add "-G" option followed by your target. For example, if you are using VisualStudio 2015:
| + | |
− | | + | |
− | '''For 32 bits:'''
| + | |
− | cmake -G "Visual Studio 14 2015" ^
| + | |
− | | + | |
− | '''For 64 bits:'''
| + | |
− | cmake -G "Visual Studio 14 2015 Win64" ^
| + | |
− | | + | |
− | You can find more info and a list of available generators here:
| + | |
− | | + | |
− | https://cmake.org/cmake/help/v3.5/manual/cmake-generators.7.html
| + | |
− | | + | |
− | ==== Set Libraries ====
| + | |
− | | + | |
− | Once the generator is correctly set, you have to make sure that the paths to all libraries are correctly set. Please make sure that you configure.bat
| + | |
− | file has the following lines with the correct path:
| + | |
− | | + | |
− | -DBOOST_ROOT="example/boost_1_59_0/" ^
| + | |
− | -DBLAS_LIBRARY="example/libblas.lib" ^
| + | |
− | -DLAPACK_LIBRARY="example/liblapack.lib" ^
| + | |
− | | + | |
− | It is possible that if you have multiple python versions in your system CMake detects the wrong one ( typically, the one with the highest version ) to avoid that, please set it manually. For instance, for Python 3.3:
| + | |
− | | + | |
− | -DPYTHON_INCLUDE_PATH="C:\Python33\include"
| + | |
− | -DPYTHON_LIBRARY="C:\Python33\libs\python33.lib"
| + | |
− | | + | |
− | ==== Enable/Disable Setting ====
| + | |
− | | + | |
− | Now, you can enable and disable the applications you may want to compile or not. For instance:
| + | |
− | | + | |
− | -DSTRUCTURAL_APPLICATION=<span style="color:green">'''ON'''</span>/<span style="color:red">'''OFF'''</span>
| + | |
− | | + | |
− | We recommend you to enable:
| + | |
− | | + | |
− | -DINSTALL_EMBEDDED_PYTHON=ON ^
| + | |
− | | + | |
− | ==== Example ====
| + | |
− | | + | |
− | Here we present a full example using these assumptions:
| + | |
− | | + | |
− | * You want a x64 build
| + | |
− | * You use VisualStudio 2015
| + | |
− | * You have boost in "C:\boost_1_59_0"
| + | |
− | * You have blas and lapack in "C:\external_libraries"
| + | |
− | * You have Python33 in "C:\Python33"
| + | |
− | * You downloaded Krats in "C:\Kratos"
| + | |
− |
| + | |
− | Also:
| + | |
− | | + | |
− | * You want to install kratos in "C:\KratosInstall"
| + | |
− | | + | |
− | del CMakeCache.txt
| + | |
− |
| + | |
− | <span style="color:red">cmake -G "Visual Studio 14 2015 x64" ^</span>
| + | |
− | -DCMAKE_BUILD_TYPE=Release ^
| + | |
− | -DCMAKE_CXX_FLAGS=" -D_SCL_SECURE_NO_WARNINGS " ^
| + | |
− | <span style="color:red">-DBOOST_ROOT="C:\boost_1_59_0" ^</span>
| + | |
− | <span style="color:red">-DPYTHON_LIBRARY="C:\Python33\libs\python33.lib" ^</span>
| + | |
− | <span style="color:red">-DPYTHON_INCLUDE_PATH="C:\Python33\include" ^</span>
| + | |
− | <span style="color:red">-DLAPACK_LIBRARIES="C:\external_libraries\liblapack.lib" ^</span>
| + | |
− | <span style="color:red">-DBLAS_LIBRARIES="C:\external_libraries\libblas.lib" ^</span>
| + | |
− | -DMESHING_APPLICATION=ON ^
| + | |
− | -DEXTERNAL_SOLVERS_APPLICATION=ON ^
| + | |
− | -DPFEM_APPLICATION=ON ^
| + | |
− | -DSTRUCTURAL_APPLICATION=ON ^
| + | |
− | -DCONVECTION_DIFFUSION_APPLICATION=ON ^
| + | |
− | -DFLUID_DYNAMICS_APPLICATION=ON ^
| + | |
− | -DALE_APPLICATION=ON ^
| + | |
− | -DFSI_APPLICATION=ON ^
| + | |
− | -DDEM_APPLICATION=OFF ^
| + | |
− | -DSWIMMING_DEM_APPLICATION=OFF ^
| + | |
− | -DINSTALL_PYTHON_FILES=ON ^
| + | |
− | <span style="color:blue">-DINSTALL_EMBEDDED_PYTHON=ON ^</span>
| + | |
− | -DEXCLUDE_ITSOL=ON ^
| + | |
− | -DSOLID_MECHANICS_APPLICATION=ON ^
| + | |
− | <span style="color:green">-DKRATOS_INSTALL_PREFIX="C:\KratosInstall" ^</span>
| + | |
− | ..
| + | |
− | | + | |
− | === Running configure.bat ===
| + | |
− | | + | |
− | * Objectives:
| + | |
− | ** Configure Kratos
| + | |
− | | + | |
− | Once the modifications of the file are done, it needs to be executed. You can do that by executing the command:
| + | |
− | | + | |
− | configure
| + | |
− | | + | |
− | In a cmd. Please check the output to ensure that all the paths and libraries are the correct ones. If the configuration has been successful you will se a '''Configuration Done''' near the end.
| + | |
− | | + | |
− | === Compiling Kratos ===
| + | |
− | | + | |
− | * Objectives:
| + | |
− | ** Compile and Install Kratos
| + | |
− | | + | |
− | Once the configuration script has finished without errors a '''"KratosMultiphysics.sln"''' will be generated in the cmake_build directory. Double click this file and the visual studio project will open.
| + | |
− | | + | |
− | Please, make sure that the project is set to "Release" and "Win32" or "x64" and change it if is not. Once this is check in order to compile Kratos, right click the "INSTALL" project and select the option "BUILD"
| + | |
− | | + | |
− | == Post Compilation ==
| + | |
− | | + | |
− | * Objectives:
| + | |
− | ** Finish last details
| + | |
− | ** Copying necessary files
| + | |
− | | + | |
− | Once the compilation process has finished, you will find are your files in the selected installation directory. You should see a directory "libs" inside. To finish the process, please copy the following files to the "libs" directory:
| + | |
− | | + | |
− | * libblas.dll
| + | |
− | * liblapack.dll
| + | |
− | | + | |
− | Also, please copy all .dll files located in your boost directory, for example:
| + | |
− | | + | |
− | * C:\boost_1_59_0\stage\lib
| + | |
− | | + | |
− | Finally, copy all the .dll located in your MinGW binary dir. for example:
| + | |
− | | + | |
− | * C:\MinGW\bin
| + | |
− | | + | |
− | == Test ==
| + | |
− | | + | |
− | * Objectives:
| + | |
− | ** Test that Kratos Works
| + | |
− | | + | |
− | To to tests the compilation, you can execute a simple python script containing this line:
| + | |
− | | + | |
− | from KratosMultiphysics import *
| + | |
− | | + | |
− | We strongly recommend you to run kratos scripts with the "runkratos" binary that will be generated inside your Kratos installation folder. You can also run them by using python (if you have compiled with python version 2.x.x), or python3 (if you have compiled with python version 3.x.x)
| + | |
− | | + | |
− | runkratos test.py
| + | |
− | python test.py
| + | |
− | python3 test.py
| + | |
− | | + | |
− | If everething was ok you will see this message:
| + | |
− | | + | |
− | | / |
| + | |
− | ' / __| _` | __| _ \ __|
| + | |
− | . \ | ( | | ( |\__ \
| + | |
− | _|\_\_| \__,_|\__|\___/ ____/
| + | |
− | Multi-Physics 3.3.11016
| + | |
− | | + | |
− | | + | |
− | BELOW THIS LINE LIES OLD CONTENT
| + | |
− | | + | |
− | ==== Running configure.bat ====
| + | |
− | Finally run configure.bat and if all is correct, the file ALL_BUILD.vcxproj will be generated.
| + | |
− | | + | |
− | It is convenient to run it in the '''Visual Studio Command Prompt''' (the 32 bit version) or a console (START->RUN and type "cmd"). This way the console will not close once it has finished configuring and therefore you can check everything is ok.
| + | |
− | | + | |
− | ::[[Image:cmake1ff.png]]
| + | |
− | | + | |
− | Note: Check that the Python and Boost's version are correct together with the path.
| + | |
− | | + | |
− | ==== Microsoft Visual Studio 2010 Kratos Project ====
| + | |
− | Open the file KratosMultiphysics.sln with Visual Studio 2010 and now we can proceed
| + | |
− | to compile Kratos.
| + | |
− | Once inside in Visual Studio 2010, it is neccesary to follow the following steps
| + | |
− | | + | |
− | a) go to -> View -> Property Manager ->
| + | |
− | | + | |
− | Note: see bellow picture.
| + | |
− | | + | |
− | [[File:ffddd.png]]
| + | |
− | | + | |
− | b) Click with the right botton over the ALL_BUILD and select PROPERTIES
| + | |
− | | + | |
− | Note: see bellow picture.
| + | |
− | | + | |
− | [[File:fffddd.png]]
| + | |
− | | + | |
− | c)Finally, select the botton corresponding CONFIGUTARION MANAGER and select INSTALL
| + | |
− | | + | |
− | Note: see above picture.
| + | |
− | | + | |
− | ==== Compilation Kratos ====
| + | |
− | | + | |
− | ::[[Image:MSVS2008_Compile_Kratos.1.jpg]]
| + | |
− | | + | |
− | ::* <font color=red> IMPORTANT: </font> Change the output mode to Release ( by default it is usually in Debug, as pictured above)
| + | |
− | | + | |
− | ::* Select Build - Build Solution (or simply hit F7 in the keyboard
| + | |
− | | + | |
− | Finally, to complete the creation of standalone copy of the Kratos you'll need to add some '''dll'''s that won't be present in most host machines. Moreover, it is also necessary to do this in your PC since some of the libraries you've just installed were not declared in the enviroment variables and therefore your system wouldn't be able to find them by itself. These libraries are the ones belonging to '''Python''', '''Boost''', '''lapack''' and '''blas'''. By adding the following files you can run '''krun.exe''' directly, even if you run Kratos in another machine where you haven't intalled these libraries.
| + | |
− | | + | |
− | <font color=red> '''Have in mind that the files provided in the ''zips'' below are for the version mentioned in the previous steps, so if you installed newer versions you'll have to look for the files inside the libraries' installation folders. ''' </font>
| + | |
− |
| + | |
− | *in the root directory of the installation path ( [[File:in_the_base_install_dir.zip]] ):
| + | |
− | ::*python27.dll
| + | |
− | ::*python27.zip (containing the folders libs and DLLs from python)
| + | |
− | *in /libs ( [[File:in_libs.zip]] ):
| + | |
− | ::* blas_win32_MD.dll
| + | |
− | ::* boost_python-vc100-mt-1_46_1.dll
| + | |
− | ::* lapack_win32_MD.dll
| + | |
− | ::* libacml_dll.dll
| + | |
− | ::* pgc.dll
| + | |
− | ::* pgftnrtl.dll
| + | |
− | [[Category: Installation]]
| + | |
− | | + | |
− | Once you've done this, to run you script you can simply go to the directory where your problem is and type in a console:
| + | |
− | C:\kratos_install_dir\runkratos.exe my_python_script.py
| + | |
− | | + | |
− | and your problem should start running.
| + | |
− | | + | |
− | [[File:Running_script.png]]
| + | |