Skip to content
Snippets Groups Projects
magma-for-intel-xeon-phi.md 3.08 KiB
Newer Older
  • Learn to ignore specific revisions
  • David Hrbáč's avatar
    David Hrbáč committed
    # MAGMA for Intel Xeon Phi
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    Next generation dense algebra library for heterogeneous systems with accelerators
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    ### Compiling and linking with MAGMA
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    To be able to compile and link code with MAGMA library user has to load following module:
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```bash
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
        $ module load magma/1.3.0-mic
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    To make compilation more user friendly module also sets these two environment variables:
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    !!! Note "Note"
    	MAGMA_INC - contains paths to the MAGMA header files (to be used for compilation step)
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    !!! Note "Note"
    	MAGMA_LIBS - contains paths to MAGMA libraries (to be used for linking step).
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    Compilation example:
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```bash
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
        $ icc -mkl -O3 -DHAVE_MIC -DADD_ -Wall $MAGMA_INC -c testing_dgetrf_mic.cpp -o testing_dgetrf_mic.o
    
    
    David Hrbáč's avatar
    David Hrbáč committed
        $ icc -mkl -O3 -DHAVE_MIC -DADD_ -Wall -fPIC -Xlinker -zmuldefs -Wall -DNOCHANGE -DHOST  testing_dgetrf_mic.o  -o testing_dgetrf_mic $MAGMA_LIBS
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    ### Running MAGMA code
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    MAGMA implementation for Intel MIC requires a MAGMA server running on accelerator prior to executing the user application. The server can be started and stopped using following scripts:
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    !!! Note "Note"
    	To start MAGMA server use:
    	**$MAGMAROOT/start_magma_server**
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    !!! Note "Note"
    	To stop the server use:
    	**$MAGMAROOT/stop_magma_server**
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    !!! Note "Note"
    	For deeper understanding how the MAGMA server is started, see the following script:
    	**$MAGMAROOT/launch_anselm_from_mic.sh**
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    To test if the MAGMA server runs properly we can run one of examples that are part of the MAGMA installation:
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```bash
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
        [user@cn204 ~]$ $MAGMAROOT/testing/testing_dgetrf_mic
    
        [user@cn204 ~]$ export OMP_NUM_THREADS=16
    
        [lriha@cn204 ~]$ $MAGMAROOT/testing/testing_dgetrf_mic
        Usage: /apps/libs/magma-mic/magmamic-1.3.0/testing/testing_dgetrf_mic [options] [-h|--help]
    
    
    David Hrbáč's avatar
    David Hrbáč committed
          M     N     CPU GFlop/s (sec)   MAGMA GFlop/s (sec)   ||PA-LU||/(||A||*N)
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
        =========================================================================
    
    David Hrbáč's avatar
    David Hrbáč committed
         1088  1088     ---   (  ---  )     13.93 (   0.06)     ---
         2112  2112     ---   (  ---  )     77.85 (   0.08)     ---
         3136  3136     ---   (  ---  )    183.21 (   0.11)     ---
         4160  4160     ---   (  ---  )    227.52 (   0.21)     ---
         5184  5184     ---   (  ---  )    258.61 (   0.36)     ---
         6208  6208     ---   (  ---  )    333.12 (   0.48)     ---
         7232  7232     ---   (  ---  )    416.52 (   0.61)     ---
         8256  8256     ---   (  ---  )    446.97 (   0.84)     ---
         9280  9280     ---   (  ---  )    461.15 (   1.16)     ---
        10304 10304     ---   (  ---  )    500.70 (   1.46)     ---
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    !!! Note "Note"
    	Please note: MAGMA contains several benchmarks and examples that can be found in:
    	**$MAGMAROOT/testing/**
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    !!! Note "Note"
    	MAGMA relies on the performance of all CPU cores as well as on the performance of the accelerator. Therefore on Anselm number of CPU OpenMP threads has to be set to 16:
    	**export OMP_NUM_THREADS=16**
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    See more details at [MAGMA home page](http://icl.cs.utk.edu/magma/).
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    ## References
    
    [1] MAGMA MIC: Linear Algebra Library for Intel Xeon Phi Coprocessors, Jack Dongarra et. al, <http://icl.utk.edu/projectsfiles/magma/pubs/24-MAGMA_MIC_03.pdf>