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

Compile c function within R desktop

Fio
Beginner
949 Views

Hello,

I would like to perform the compilation of the following C code (which is saved on the path "C:\Users\Desktop\example.c") directly within the R desktop environment.

#include <stdio.h>
#include <mkl.h>
int main() {
    double x[] = {1.0, 2.0, 3.0};
    double y[] = {4.0, 5.0, 6.0};
    double z;
    // Perform vector multiplication and summation using Intel MKL
    z = cblas_ddot(3, x, 1, y, 1);
    printf("Result: %lf\n", z);
    return 0;
}

I executed the following command in R desktop, but an issue occurred during the process.

> system('icx -o myfunction "C:\\Users\\Desktop\\example.c" /Qmkl /MD')
Intel(R) oneAPI DPC++/C++ Compiler for applications running on Intel(R) 64, Version 2023.1.0 Build 20230320
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

LINK : fatal error LNK1104: cannot open file 'libiomp5md.lib'
icx: error: linker command failed with exit code 1104 (use -v to see invocation)
[1] 1104

My environment variables are displayed in the image below. 

Screenshot 2023-09-26 135508.png

I've installed the Intel® oneAPI Base Toolkit on a Windows platform.

Than you very much.

0 Kudos
4 Replies
VarshaS_Intel
Moderator
860 Views

Hi,


Thanks for posting in Intel Communities.


>>C code (which is saved on the path "C:\Users\Desktop\example.c") directly within the R desktop environment.

Could you please let us know the R version you have downloaded and who you are trying to link with which version of the Intel MKL?


Also, could you please provide us with the complete steps you followed on R Desktop to compile this code Intel compilers?


Thanks & Regards,

Varsha



0 Kudos
VarshaS_Intel
Moderator
817 Views

Hi,


>>LINK : fatal error LNK1104: cannot open file 'libiomp5md.lib'

Regarding the error you are getting on libiomp5md.lib file is from the Intel compilers folder, could you please check whether everything is installed properly and also check whether you are linking properly whether it is 32-bit or 64-bit?


Could you please try linking the Intel Compilers with Intel MKL and let us know if you are facing any errors?


Thanks & Regards,

Varsha



0 Kudos
VarshaS_Intel
Moderator
749 Views

Hi,


We have not heard back from you. Could you please provide us with an update on your issue?


Thanks & Regards,

Varsha


0 Kudos
VarshaS_Intel
Moderator
666 Views

Hi,


We have not heard back from you. Could you please provide us with an update on your issue?


Thanks & Regards,

Varsha


0 Kudos
Reply