Matrix Multiply (DGEMM)

Follow this procedure to run a simple oneMKL matrix multiply example.

  • Operating system: Ubuntu* 22.04

  • Hardware: Intel® Data Center Max GPUs

  • Software: Intel® oneAPI Base toolkit, Intel® oneAPI HPC toolkit

  • Time to complete: 15 minutes

For more information on the matrix multiplication with oneMKL sample, see Matrix Multiplication with oneMKL Sample.

  1. Check whether the driver stack is installed.

    $ xpu-smi discovery
    

    The command should return at least one Intel® Data Center GPU Max device.

  2. Check whether the oneAPI toolkit is installed.

    $ apt list intel-basekit intel-hpckit
    

    Expected output:

    Listing... Done
    intel-basekit/all,now 2023.2.0-49384 amd64 [installed]
    intel-hpckit/all,now 2023.2.0-49438 amd64 [installed]
    
  3. If you previously have not configured your environment, install the Ubuntu 22.04 graphics driver. See dgpu-docs for details.

    Note

    Access to Ubuntu repositories, such as https://repositories.intel.com and https://apt.repos.intel.com, is required for installation. If proxy settings involve changes to environment variables such as http_proxy or https_proxy, small modifications are required in the following steps, such as adding -E (preserve environment) to sudo commands.

  4. If you previously have not configured your environment, enable access to the Intel repo serving the oneAPI packages and install the oneAPI Base toolkit and HPC toolkit for Ubuntu 22.04.

    wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
    echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo  tee /etc/apt/sources.list.d/oneAPI.list
    sudo apt update
    
    sudo apt install -y intel-basekit intel-hpckit
    
  5. Build DGEMM, which is a oneAPI sample.

    git clone https://github.com/oneapi-src/oneAPI-samples.git
    cd oneAPI-samples/Libraries/oneMKL/matrix_mul_mkl
    source /opt/intel/oneapi/setvars.sh 
    make
    
  6. Run DGEMM.

    $ ./dgemm.mkl
    

The following result snapshot is from Intel® Data Center GPU Max 1550:

Problem size:  A (8192x8192) * B (8192x8192)  -->  C (8192x8192)
Benchmark interations: 100
Device: Intel(R) Data Center GPU Max 1550
Launching oneMKL GEMM calculation...