Developer Guide

Developer Guide for Intel® oneAPI Math Kernel Library macOS*

ID 766688
Date 11/07/2023
Public
Document Table of Contents

Using MKL_DIRECT_CALL in C Applications

The following examples of code and link lines show how to activate direct calls to Intel® oneAPI Math Kernel Library (oneMKL) kernels in C applications:

  • Include the mkl.h header file:

    #include "mkl.h" 
    int main(void) {
        
    // Call Intel MKL DGEMM 
        
    return 0;
    }
    
  • For multi-threaded Intel® oneAPI Math Kernel Library (oneMKL), compile withMKL_DIRECT_CALL preprocessor macro:

    icx –DMKL_DIRECT_CALL -std=c99 your_application.c $(MKLROOT)/lib/intel64/libmkl_intel_lp64.a 
    $(MKLROOT)/lib/intel64/libmkl_core.a $(MKLROOT)/lib/intel64/libmkl_intel_thread.a -lpthread –lm -openmp -I$(MKLROOT)/include
  • To use Intel® oneAPI Math Kernel Library (oneMKL) in the sequential mode, compile withMKL_DIRECT_CALL_SEQ preprocessor macro:

    icx –DMKL_DIRECT_CALL_SEQ -std=c99 your_application.c $(MKLROOT)/lib/intel64/libmkl_intel_lp64.a 
    $(MKLROOT)/lib/intel64/libmkl_core.a $(MKLROOT)/lib/intel64/libmkl_sequential.a -lpthread –lm -I$(MKLROOT)/include

Product and Performance Information

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.

Notice revision #20201201