-
Notifications
You must be signed in to change notification settings - Fork 258
Windows Install
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
- Windows 8
- Windows 8.1
If you are not familiar with the following concepts listed below, please take five minutes read the windows basic section (TODO).
Tested and working configurations:
-Visual Studio 2015 Community with Python 3.4 and Boost 1.59.
Visual studio is the only compiler officially supported to build Kratos under Windows. Since the adoption of C++11 we support versions 2015 onwards. The complete list of known working versions is presented here (other variants like 'Professional ' also work):
Please notice that:- If you want OpenMP support you must download a Community or Professional variant. Express variant do not have support for OpenMP
- Since Visual Studio is a multi-language IDE, some distributions come without C++ compiler. Please, make sure that you can create a C++ project before continue, in case C++ packages were missing you will be prompt to download them.
- Avoid installing the Update 3 of Visual Studio 2015 Community, it cannot compile Kratos. You must use Update 2 If you have already updated it, you should uninstall Visual Studio and reinstall it without the updates. Uninstalling just the update through Control Panel (through the Updates manager) does not work.
- When installing VisualStudio 2015 Community, it is advisable to download the ISO file (vs2015.com_enu.iso) instead of the web installer (vs_community.exe) so as to prevent update 3 from being installed.
- Objectives:
- Install git
- Get Kratos Multiphysics source code
https://github.com/KratosMultiphysics/Kratos
Once this is done, you should have a "Kratos" directory containing Kratos soruces
- Objectives:
- Install CMake
Please notice that if you want to use python 3.4 or higher, you will need CMake 3.0.2 or higher.
- Objectives:
- Install Python3
- Objectives:
- Get LIBBLAS and LIBLAPACK
For 32 bits
http://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.
For 64 bits
http://web.cimne.upc.edu/users/maceli/data/libs.7z
Please notice that temporally we recommend to use an older version of the libs for 64 bits.
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:
http://sourceforge.net/projects/mingw-w64/
Warning: After launching the installer, several options must be selected. Choose version 6.4.0. Please take special care to select the correct architecture during this installation (32 bits is called 'x86', 64 bits is called 'x64').
- Objectives:
- Compile boost libraries
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 will need to know which version of MSVC you are using. This version depends on the visual studio that you install in your system. In the list below you will find the correct version of MSVC for every version of visual studio and its usage in the command ( in red ):
Visual studio 2015: --toolset=msvc-14.0
For 32 bits:
b2 --toolset=msvc-14.0 --build-type=complete architecture=x86 stage --with-python --with-serialization variant=release link=shared,static
For 64 bits:
b2 --toolset=msvc-14.0 --build-type=complete architecture=x86 address-model=64 stage --with-python --with-serialization variant=release link=shared,static
If you intend to debug please remove the variant=release option.
Ej: For Debug (x64)
b2 --toolset=msvc-14.0 --build-type=complete architecture=x86 address-model=64 stage --with-python --with-serialization link=shared,static
Warning: If you use boost 1.65 or greater and python3 please add this line to your configure:
-DBOOST_PYTHON_SUFFIX="3" ^
- Objectives:
- Prepare Kratos configuration file
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
Warning: If you already configured for 32 bits and compiled, remove all the files in the folder cmake_build except the .bat file used for configuration. Not removing them can lead to strange errors during compilation.
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_LIBRARIES="example/libblas.lib" ^ -DLAPACK_LIBRARIES="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"
Now, you can enable and disable the applications you may want to compile or not. For instance:
-DSTRUCTURAL_APPLICATION=ON/OFF ^
We recommend you to enable:
-DINSTALL_EMBEDDED_PYTHON=ON ^
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 Kratos in "C:\Kratos"
del CMakeCache.txt cmake -G "Visual Studio 14 2015 Win64" ^ -DCMAKE_BUILD_TYPE=Release ^ -DCMAKE_CXX_FLAGS=" -D_SCL_SECURE_NO_WARNINGS " ^ -DBOOST_ROOT="C:\boost_1_59_0" ^ -DPYTHON_LIBRARY="C:\Python33\libs\python33.lib" ^ -DPYTHON_INCLUDE_PATH="C:\Python33\include" ^ -DLAPACK_LIBRARIES="C:\external_libraries\liblapack.lib" ^ -DBLAS_LIBRARIES="C:\external_libraries\libblas.lib" ^ -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 ^ -DINSTALL_EMBEDDED_PYTHON=ON ^ -DEXCLUDE_ITSOL=ON ^ -DSOLID_MECHANICS_APPLICATION=ON ^ ..
Warning: All these options must be written in the same line, the symbol '^' tells the cmake to read the following line as if it was the same. If you add new options, like the ones in red, do not forget to put this symbol at the end of every line and do not write spaces after this symbol.
- Objectives:
- Configure Kratos
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.
- Objectives:
- Compile and Install Kratos
- Objectives:
- Finish last details
- Copying necessary files
- libblas.dll
- liblapack.dll
- C:\boost_1_59_0\stage\lib
- C:\MinGW\bin
- Objectives:
- Test that Kratos Works
- Get familiar with the execution process
To to test the compilation, you can prepare a simple script (for example "test_kratos.py") that contains this line:
from KratosMultiphysics import *
Then you can execute this script as explained in the next section.
The most easy way to execute a KratosMultiphysics script from the command line is to prepare a ".bat" file. A ".bat" file is just a series of commands that are executed together and will make the process simpler. This file should contain only two lines. First the path for the kratos executable and libs folders, and the second, the actual command. For instace:
- Your Downloaded Kratos in "C:\Kratos"
- Your script is called "test_kratos.py"
set PATH=C:\\Kratos;C:\\Kratos\\libs;%PATH% "C:\\Kratos\\runkratos" test_kratos.py
We strongly recommend you to run kratos scripts with the "runkratos" binary inside your Kratos installation folder, because it gives the correct values to the environment variables.
runkratos test.py
Or more exactly, you can go to the folder where your case is (input files and main python script) and type:
path_to_kratos/runkratos test.py
You can also run them directly using the python you have installed in your system (provided that the system knows where python is and the environment variables have the correct values assigned, PYTHONPATH, LD_LIBRARY_PATH and PATH).
python test.py python3 test.py python35 test.py
If everything is correct you will see this message:
| / | ' / __| _` | __| _ \ __| . \ | ( | | ( |\__ \ _|\_\_| \__,_|\__|\___/ ____/ Multi-Physics 3.3.XXXXX
TODO
You have a conflicting declaration of round. This could happen for example if you have multiple versions of Visual Studio in your computer. Please add "-DHAVE_ROUND" to the configure cxxflags entry:
-DCMAKE_CXX_FLAGS=" -D_SCL_SECURE_NO_WARNINGS -DHAVE_ROUND"
- Getting Kratos (Last compiled Release)
- Compiling Kratos
- Running an example from GiD
- Kratos input files and I/O
- Data management
- Solving strategies
- Manipulating solution values
- Multiphysics
- Video tutorials
- Style Guide
- Authorship of Kratos files
- Configure .gitignore
- How to configure clang-format
- How to use smart pointer in Kratos
- How to define adjoint elements and response functions
- Visibility and Exposure
- Namespaces and Static Classes
Kratos structure
Conventions
Solvers
Debugging, profiling and testing
- Compiling Kratos in debug mode
- Debugging Kratos using GDB
- Cross-debugging Kratos under Windows
- Debugging Kratos C++ under Windows
- Checking memory usage with Valgind
- Profiling Kratos with MAQAO
- Creating unitary tests
- Using ThreadSanitizer to detect OMP data race bugs
- Debugging Memory with ASAN
HOW TOs
- How to create applications
- Python Tutorials
- Kratos For Dummies (I)
- List of classes and variables accessible via python
- How to use Logger
- How to Create a New Application using cmake
- How to write a JSON configuration file
- How to Access DataBase
- How to use quaternions in Kratos
- How to do Mapping between nonmatching meshes
- How to use Clang-Tidy to automatically correct code
- How to use the Constitutive Law class
- How to use Serialization
- How to use GlobalPointerCommunicator
- How to use PointerMapCommunicator
- How to use the Geometry
- How to use processes for BCs
- How to use Parallel Utilities in futureproofing the code
- Porting to Pybind11 (LEGACY CODE)
- Porting to AMatrix
- How to use Cotire
- Applications: Python-modules
- How to run multiple cases using PyCOMPSs
- How to apply a function to a list of variables
- How to use Kratos Native sparse linear algebra
Utilities
Kratos API
Kratos Structural Mechanics API