-
Notifications
You must be signed in to change notification settings - Fork 59
InstallingMinGW
To be able to compile ADDA on Windows you need to install MinGW-w64 and MSYS. Using Visual Studio or other compilers should be possible, but we do not have experience with that.
- Dowload and run MinGW-w64 installer.
- It will propose the latest version and other default options. Important, change
Architecture
tox86_64
to compile native 64-bit application (see below for 32-bit options). Choice ofThreads
andExceptions
does not seem important for ADDA, but will affect the DLLs to be distributed together with ADDA executable. The default choice (posix
andseh
, respectively) is used for releases since version 1.4. - It will propose the default installation folder inside
C:\Program Files\mingw-w64
. We recommend to removeProgram Files\
from this path, so the installation will be inC:\mingw-w64
. - Further installation will proceed automatically and should install all necessary compiler components, including
gfortran
andgdb
.
MSYS is a collection of 32-bit Unix system utils, such as make
and awk
, which work fine with both 32- and 64-bit Windows. To install it we recommend the second option from MinGW-w64 instructions:
- Download the latest full MSYS package (zip archive) from this repository. Currently, it is the one dated 23.11.2011 and is not expected to be updated.
- Extract the archive into
C:\
, then everything will be located inC:\msys\
- Instructions include running
C:\msys\postinstall\pi.bat
, but that does not seem necessary. - (Optional for MSYS shell) Mofify
C:\msys\etc\profile
:- Remove
cd "$HOME"
at the end. This will help when executingsh --login
to open shell at the desired path. - Replace
HOME="/home/$LOGNAME"
withHOME="$USERPROFILE"
. In particular, this will make global git config visible inside this shell. The only potential drawback is that the new home folder will be shared with, e.g., Git Bash (see below). Together with this change:- If you already have any meaningful files in the MSYS home folder, copy them to the Windows home folder (
$USERPROFILE
). - Otherwise consider renaming
C:\msys\etc\inputrc.default
toinputrc
, or to$USERPROFILE\.inputrc
(shared with other shells). The latter is exactly, what is done insideprofile
if the home directory does not exist.
- If you already have any meaningful files in the MSYS home folder, copy them to the Windows home folder (
- Remove
Finally, setup the environment:
- Add
C:\msys\bin
and corresponding mingw-w64 folder, e.g.C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin
, to Windows environmental variablePATH
.
Now you are ready to compile ADDA from a console. The only drawback of the concise procedure, described above, is that you need to manually specify include and library paths for external packages, such as FFTW3, in makefiles.
Concerning the consoles, we have tested standard cmd
, as well as sh
from C:\msys\bin
. There are some issues with other ones:
- Built-in console of Far Manager (v3.0 x64) breaks the compilation, since it somehow cause modification of
$(MAKE)
in Makefile. A workaround is to runsh -c "make ..."
. - Git Bash (installed with Git for Windows) breaks compilation in OpenCL mode, probably due to some inconsistent handling of line endings when
sed ...
is applied tooclkernels.cl
in ocl/Makefile.
These options may be of interest to developers or to those, who plan to compile ADDA many times with different options. These steps should be performed after the basic steps, described above.
Make sure that all necessary external packages are installed, such as FFTW3, MPI, OpenCL, clFFT, or clBLAS. Those that have Windows installers, usually make the corresponding DLLs available directly (i.e. they are placed in C:\Windows\System32
or their folder is included in PATH
). Otherwise, we recommend to:
- Extract the packages inside
C:\msys\local\
(create these folders if necessary) - place each package inside a folder with name including the version to facilitate further updates. - Add the folders containing packages DLLs, such as
...\bin
to the environmental variablePATH
. Thus, the produced ADDA executables can be moved freely around the file system without DLLs.
To avoid need to manually specify include and library paths for external packages in makefiles, do the following (partly based on MinGW instructions):
- The folders
C:\msys\local\include
andC:\msys\local\lib
need to exist and contain headers and libraries of external packages, respectively. The recommended option is to keep packages intact but create symbolic links (using 64-bit console with administrative privileges), for example:cd C:\msys\local mklink /D include\fftw ..\fftw-3.3.5 mklink lib\libfftw3.dll ..\fftw-3.3.5\libfftw3-3.dll mklink lib\OpenCL.dll C:\Windows\System32\OpenCL.dll mklink /D include\clfft ..\clFFT-2.12.2\include mklink lib\clFFT.dll ..\clFFT-2.12.2\bin\clFFT.dll mklink /D include\clblas ..\clBLAS-2.12.0\include mklink lib\clBLAS.dll ..\clBLAS-2.12.0\bin\clBLAS.dll
- Locate the library folder of your gcc installation, its path (
<gcclib-path>
) should be likeC:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\lib\gcc\x86_64-w64-mingw32\8.1.0`
- Look for file
specs
in folder<gcclib-path>
. If it does not exist, execute in this foldergcc -dumpspecs > specs
- Modify
specs
file:-
Add the following to the beginning:
*local_prefix: c:/msys/local/ *local_incl: %(local_prefix)include *local_includes: -I%(local_incl)/fftw -I%(local_prefix)/OpenCL-Headers -I%(local_incl)/clfft -I%(local_incl)/clblas *local_lib: %(local_prefix)lib *local_lib_search: -L%(local_lib)
-
Add
%(local_includes)
to end of definition forcpp
, changing it to, e.g.,*cpp: %{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} %(local_includes)
-
Add
%(local_includes)
to end of definition forcc1plus
, changing it to, e.g.,*cc1plus: %(local_includes)
-
Add
%(local_lib_search)
to end of definition forlink_libgcc
, changing it to, e.g.,*link_libgcc: %D %(local_lib_search)
-
Since version 1.4 we do not provide 32-bit executables, since some of the external libraries, such as clFFT and clBLAS, are not immediately available in this format. Moreover, we believe that it is overall a bad idea to run ADDA on such systems due to limited available RAM. However, there are no principal internal limitations in ADDA. Therefore, if you really want to compile ADDA for 32 bit Windows, that is possible. We give brief notes on that in the following:
- Follow the above guidelines for 64-bit Windows, but select the MinGW-w64 toolchain with
Architecture
set toi686
. - All external libraries should be for 32-bit Windows. If you can't find some libraries either compile them yourself or avoid them by compilation options.
- If you compile 32-bit executable in 64-bit Windows and use system DLLs for linking (e.g.
OpenCL.dll
), use the ones fromC:\Windows\SysWOW64
instead ofC:\Windows\System32
.
Multilib configuration is, in principle, possible, i.e. to compile both 32- and 64-bit executables from a single machine. Look at the previous version of this wiki page for detailed, but somewhat outdated instructions. The additional complication is that a multilib toolchain of MinGW-w64 is required, containing both 32- and 64-bit versions of all libraries. They are available, but are updated not that often. So an easier option will be:
- Install two separate MinGW-w64 toolchains, targeting 32- and 64-bit, as described above.
- Do not put paths to
bin
folders of these toolchains into the systemPATH
. Instead, add an appropriate toolchain (path) inside the console immediately before the compilation. - Place 32-bit libraries (or links to them) into
C:\msys\local\lib32
instead oflib
.
Home (Getting started)
Frequently asked questions
Features
Tutorial
Comparison with other codes
Largest simulations
Compiling ADDA
Installing FFTW3
Installing MPI
Using OpenCL
Installing clFFT
Installing clBLAS
Using sparse mode
Installing MinGW
Using MSYS2
Papers that use ADDA
Awards
References
Links
Acknowledgements
Instruction for committers
Code design & structure
Style guide
Using VS Code
Using Eclipse
Early development history
Adding new ...