Software Archive
Read-only legacy content
17061 Discussions

How to protect code from triggering MIC build on non-MIC nodes

tjahns
Beginner
687 Views

Hello,
we have two clusters in-house, one with MIC cards and another without. When we build code with OpenMP 4.x pragmas or functions for devices, we get a compilation error on the cluster without MIC cards:

icc: warning #10362: Environment configuration problem encountered.
Please check for proper MPSS installation and environment setup.
testomp.c(1): catastrophic error: *MIC* cannot open source file "stdio.h"
   #include <stdio.h> 

 

This happens with Intel icc 14.0.3 and 15.0.2. The problem with stdio.h is just an example of missing headers, other compilations fail for different reasons because the MPSS is not installed on the non-MIC cluster. Both clusters use Linux, RHEL6 in the non-MIC, CentOS 6 in the MIC case.

What #ifdefs need to be in place to build the same code on the non-MIC cluster as well as the MIC cluster?

Perhaps I should add: the code portions triggering the error are already protected by

#if _OPENMP >= 201307

#endif

 

Regards, Thomas

 

0 Kudos
7 Replies
Kevin_D_Intel
Employee
687 Views

This may not require any special #ifdef's. Can you try compiling on the cluster without Xeon Phi cards using: -qno-openmp-offload

This disables the OpenMP 4.x offload compilation; there is more information here in the C++ UG. This option was first introduced in 15.0 with initial support for OpenMP 4.x offloading. It would not be available in 14.x but then neither is the OpenMP 4.x offloading support.

When using the Intel Language Extensions for Offload, there is a similar variant available of: -qno-offload  described in the UG here.

0 Kudos
Kevin_D_Intel
Employee
687 Views

I stand corrected. This option was available in 14.x so perhaps if it delivers the functionality you need then it would be usable with 14.x also. Sorry for the confusion.

0 Kudos
tjahns
Beginner
687 Views

Unfortunately, no-offload doesn't seem to make a difference:

$ icc -O2 -qno-offload -fopenmp testomp.c 
icc: warning #10362: Environment configuration problem encountered.  Please check for proper MPSS installation and environment setup.
testomp.c(1): catastrophic error: *MIC* cannot open source file "stdio.h"
  #include <stdio.h>
                    ^

compilation aborted for testomp.c (code 4)

I'd like to post the code here, but even when it's trivial I'll need to get permission from the author first, who is going to be around again on Monday.

Regards, Thomas

0 Kudos
Kevin_D_Intel
Employee
687 Views

The -no-offload (-qno-offload in 15.x and later) option will only apply when using Intel's offload language extensions. If you are using the OpenMP 4.x TARGET device constructs then use the OpenMP specific form of the option: -qno-openmp-offload

It should work from what I'm seeing.

$ icc -V
Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.5.212 Build 20150212
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

$ icc -c t2.c -fopenmp -openmp-offload
icc: warning #10362: Environment configuration problem encountered.  Please check for proper MPSS installation and environment setup.

$ icc -c t2.c -fopenmp -no-openmp-offload
t2.c(8): warning #3180: unrecognized OpenMP #pragma
  #pragma omp target
          ^

Note the 14.x compiler had not adopted the leading "q" in the option. That came in 15.x and later.

0 Kudos
tjahns
Beginner
687 Views

That still doesn't work for the test program I have here:

$ icc -O2 -qno-offload -fopenmp testomp.c 
icc: warning #10362: Environment configuration problem encountered.  Please check for proper MPSS installation and environment setup.
testomp.c(1): catastrophic error: *MIC* cannot open source file "stdio.h"
  #include <stdio.h>
                    ^

compilation aborted for testomp.c (code 4)

The program is simple, please see the uploaded attachment. omp_get_num_devices() seems to have a different effect on the compiler than having a target construct.

0 Kudos
Ravi_N_Intel
Employee
687 Views

The problem is omp_get_num_devices().  Using this triggers compilation for the target.  We have a bug failed against this which we will address so when -qno-openmp-offload  is used and have omp_get_num_devices() in the code we will not trigger target compilation.

For now try this

#ifdef NOCARD
#define OMP_GET_NUM_DEVICES   0
#else
#define OMP_GET_NUM_DEVICES omp_get_num_devices()
#endif

and in your code

fprintf(stderr, "  max_threads = %d\n", OMP_GET_NUM_DEVICES);

when compiling in environment where MPSS is not installed -DNOCARD -qno-openmp-offload -qopenmp

Ravi

0 Kudos
Kevin_D_Intel
Employee
687 Views

Thank you for the example. This looks like a compiler defect. omp_get_num_devices() is a host-side routine so I would not expect it to trigger the target compilation which it what happens and leads to the error.

This was reported earlier to Development (see internal tracking id below).

(Internal tracking id: DPD200364738)

<Updated> As Ravi noted, this was reported earlier and we will have this fixed in a future release.

0 Kudos
Reply