Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*
777 Discussions

Porting Issue from icpc to icpx with the Combination of #pragma vector and #pragma omp parallel for

ultimatile
Beginner
1,859 Views

Hello Intel community,

I am currently facing an issue while attempting to build the HPTT library, which successfully compiles with icpc but encounters problems with icpx.

Here is a minimal working example that demonstrates the issue:

 

int main(){
  int N = 100;
  int a[N];
  #pragma vector nontemporal
  #pragma omp parallel for
  for (int i = 0 ; i < N; i++){
    a[i] = 0;
  }
  return 0;
}

 

The compilation command is 

icpx main.cpp -qopenmp

The icpx throws the following error:

main.cpp:5:3: error: expected a for, while, or do-while loop to follow '#pragma vector'
  #pragma omp parallel for
  ^

It seems that icpx is unable to recognize the for loop immediately after the OpenMP pragma, whereas icpc handles it correctly.

 

I am seeking guidance on understanding the impacts of changing the compiler from icpc to icpx in this context.

Any insights or recommendations on how to address this issue would be appreciated.

 

Thank you in advance.

 

HPTT is https://github.com/springer13/hptt.

The details of this library are probably not relevant to this issue.

The code I am actually trying to compile is more complex, so if you need that information, I will provide it.

 

The compiler information is:

$icpx --version

Intel(R) oneAPI DPC++/C++ Compiler 2023.0.0 (2023.0.0.20221201)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/local/intel/oneapi/compiler/2023.0.0/linux/bin-llvm
Configuration file: /home/local/intel/oneapi/compiler/2023.0.0/linux/bin-llvm/../bin/icpx.cfg

 

Labels (1)
0 Kudos
2 Replies
Alex_Y_Intel
Moderator
1,581 Views

Hi @ultimatile thanks for posting your question here. I've escalated your issue and our engineers will work on it internally. 

0 Kudos
ultimatile
Beginner
1,463 Views

I deeply appreciate your reply and escalation to the engineers.

I have been provided with a workaround, which I will share here.

The workaround involves using "#pragma omp parallel for simd nontemporal" instead of "#pragma vector nontemporal" and "#pragma omp parallel for."

 

Below is the code provided by the Intel engineer:

 

#include <omp.h>
int main(){
        int N = 10000; int a[N];
#pragma omp parallel for simd nontemporal (a)
        for (int i = 0 ; i < N; i++){
                a[i] = 0;
        }
        return 0;
}

 

This code can compile successfully with icpx.

0 Kudos
Reply