Resolve Memory Access Issue

At this point in the Tutorial, you edit the source code and recompile the application to resolve the main memory access bottleneck.

Note

Follow these steps to edit and recompile the code using the Intel® oneAPI DPC++/C++ Compiler:

  1. In the /opt/intel/oneapi/compiler/latest/env folder, run this command to set compiler environment variables:

    source env.vars
  2. Locate the matrix sample application folder on your machine. By default, it is placed in:

    $HOME/intel/vtune/samples/matrix

  3. Using a text editor of your choice, open the Makefile located in the ../matrix/linux/ folder.

  4. Change line 42 from:

    CFLAGS  = -g -O3 -fno-asm

    To:

    CFLAGS  = -g -O1
  5. Change line 43 from:

    OPTFLAGS = -xSSE3 

    To:

    OPTFLAGS = 
  6. Save and close the Makefile.

  7. Open the multiply.h header file located in ../matrix/src folder with a text editor.

  8. Change line 36 from:

    #define MULTIPLY multiply1

    To:

    #define MULTIPLY multiply2

    This changes the program to use the multiply2 function from the multiply.c source file, which implements the loop interchange technique that resolves the memory access problem.

  9. Save and close the multiply.h file.

  10. Navigate to the ../matrix/linux folder and use this command to recompile the application:

    make icc

Next step: Analyze Performance After Optimization.