# PLASMA CMAKE BUILD NOTES

These notes are intended to help you build PLASMA using the CMake build system. The open source CMake build system can be downloaded and installed from http://www.cmake.org/.

Currently, the CMake build system is used mainly to generate Windows binaries and packages. In the future CMake may also be used for the Unix and Linux builds.

## PLASMA on a Windows Machine

For Windows, PLASMA is distributed as a pre-built package for 32 and 64 bit architectures. The only extra requirement is an external BLAS library that needs to be available.

For your convenience, precompiled versions of the reference BLAS, LAPACK and MATGEN libraries are included, however your performance using these libraries will be very low, and the libraries themselves may be out-of-date. Please obtain and use optimized math libraries, e.g., Intel MKL, AMD ACML, Atlas BLAS, Goto BLAS. Precompiled versions of the LAPACKE and blas_cwrapper libraries are also included.

### Building and Running PLASMA applications on a Windows Machine

The examples directory contains a Makefile.nmake that gives several examples of how to compile and link example PLASMA programs using different compilers and BLAS in 32 or 64 bit precisions. Adjust to your environment, and compile and run the examples. On a Windows machine, using a command window, you should be able to do the following.

    cd examples
    nmake -f Makefile.nmake example_dpotrf.c
    example_dpotrf.exe

### Building PLASMA libraries on a Windows Machine

You should normally not need to rebuild PLASMA, but you may chose to do so. The tested build environment consists of Intel C and Fortran compilers with the Intel MKL BLAS. You will need to have the CMake build system installed. Currently the CMake build requires that you do not build in the source directory so that pre-existing files are not clobbered. The examples below create a separate BUILD directory and do the builds there. For your convenience, certain required libraries (BLAS, LAPACK, MATGEN, LAPACKE, blas_cwrapper) are pre-built and included in the binary Windows package. If you have optimized versions of these libraries, please link to them instead.

### Building 64 bit on Windows with Intel Environment

Assuming you are in top directory for your PLASMA distribution. Set up a command shell with the Intel environment (adjust paths for your machine).

    call "c:/Program Files (x86)/Intel/Compiler/11.1/067/bin/ifortvars.bat" intel64
    call "c:/Program Files (x86)/Intel/Compiler/11.1/067/bin/iclvars.bat" intel64
    call "c:/Program Files/Intel/MKL/10.0.4.023/tools/environment/mklvarsem64t.bat"
    mkdir BUILD
    cd BUILD
    cmake -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_C_COMPILER=icl -DCMAKE_CXX_COMPILER=icl -DLAPACKE_LIBRARIES=../lib/lapacke.lib -DCLAPACK_INCLUDES=include -G "NMake Makefiles" ..
    nmake

### Building 32 bit on Windows with Intel Environment

Assuming you are in top directory for your PLASMA distribution. Setup a command shell with the Intel environment (adjust paths for your machine)

    call "c:/Program Files (x86)/Intel/Compiler/11.1/067/bin/ifortvars.bat" ia32
    call "c:/Program Files (x86)/Intel/Compiler/11.1/067/bin/iclvars.bat" ia32
    call "c:/Program Files/Intel/MKL/10.0.4.023/tools/environment/mklvars32.bat"
    mkdir BUILD
    cd BUILD
    cmake -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_C_COMPILER=icl -DCMAKE_CXX_COMPILER=icl -DLAPACKE_LIBRARIES=../lib/lapacke.lib -DCLAPACK_INCLUDES=include -G "NMake Makefiles" ..
    nmake