Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7036 Discussions

compile R code with the Intel Compiler on Windows

Maraki
Beginner
490 Views

I have a time-consuming subfunction in R that I want to optimize using the oneMKL library. However, I don't know how to compile it using the Intel compiler. I have installed Intel oneAPI on windows.

Could you please provide step-by-step guidance on how to accomplish this?

For example, the example C function is:

#include <stdio.h>
#include <mkl.h>

int main() {
    // Define vector size and variables
    int n = 1000;
    double *x, *y;
    double result;

    // Allocate memory for the vectors
    x = (double*)malloc(n * sizeof(double));
    y = (double*)malloc(n * sizeof(double));

    // Initialize the vectors with some data (you can modify this)
    for (int i = 0; i < n; i++) {
        x[i] = i + 1.0;
        y[i] = 2.0 * (i + 1.0);
    }

    // Calculate the dot product of the vectors using MKL
    result = cblas_ddot(n, x, 1, y, 1);

    // Print the result
    printf("Dot product: %lf\n", result);

    // Free allocated memory
    free(x);
    free(y);

    return 0;
}

Thank you in advance.

0 Kudos
1 Reply
VarshaS_Intel
Moderator
438 Views

Hi,


Thanks for posting in Intel Communities.


Since this is a duplicate thread of https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Intel-MKL-with-R-Similar-to-MATLAB-Implementation/m-p/1520165/emcs_t/S2h8ZW1haWx8Ym9hcmRfc3Vic2NyaXB0aW9ufExNNEhRT040QUtITzRIfDE1MjAxNjV8U1VCU0NSSVBUSU9OU3xoSw#M35031, we will no longer monitor this thread. We will continue addressing this issue in the other thread. 


Have a Good Day!


Thanks & Regards,

Varsha


0 Kudos
Reply