Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28383 Discussions

ifx compiler error #8945: Generalized I/O not supported in an offload region.

John_Michalakes
797 Views

Compiling the snippet: 

!$omp target
      write(*,*)1234
!$omp end target

generates the error:

ifx -qopenmp -fopenmp-targets=spir64 -g -traceback  -c tbp.F90
tbp.F90(53): error #8945: Generalized I/O not supported in an offload region.
      write(*,*)1234
------^
compilation aborted for tbp.F90 (code 1)

Note: Simple write statements to standard output from an OpenACC offload region are supported by the Nvidia (PGI) compiler. 

Questions:

  • Is it possible to have debugging output in a target region of a Fortran program using OpenMP offload and compiling with ifx?
  • If this is not currently supported, are there plans for ifx to support simple output from target regions in the future? 
  • Any other suggestions for inspecting the values of variables in running device code?

Thank you,

John

 

 

0 Kudos
9 Replies
Barbara_P_Intel
Moderator
750 Views

This snippet compiles for me .

$ cat snippet.f90
program snippet
!$omp target
x = 1234.
print *, x
print *, 1234
!$omp end target
stop
end
$ ifx -qopenmp -fopenmp-targets=spir64 snippet.f90
$ ifx -what --version
ifx (IFORT) 2022.0.0 20211123
Copyright (C) 1985-2021 Intel Corporation. All rights reserved.

 

 

 

 

0 Kudos
John_Michalakes
735 Views

Thanks for looking into this.  It must be because I was using a write(*,*) instead of print*

If I change one of the prints in your snippet I get:

$ cat snip.F90
program snippet
!$omp target
x = 1234.
write(*,*) x
print *, 1234
!$omp end target
stop
end
$ ifx -qopenmp -fopenmp-targets=spir64 snip.F90
snip.F90(4): error #8945: Generalized I/O not supported in an offload region.
write(*,*) x
^
compilation aborted for snip.F90 (code 1)
$

Mystery solved, thank you.

John 

0 Kudos
Barbara_P_Intel
Moderator
731 Views

You're welcome.

I tried variations of the write, like write(6,*) and write(6,5). All got that same message. But print does compile.


0 Kudos
Steve_Lionel
Honored Contributor III
711 Views

Of course, this IS a bug. If one is accepted, all of these should be.

Barbara_P_Intel
Moderator
699 Views

According to the Fortran developers, "At this time, the only I/O we’re allowing in an offload region is 'print *' and even that is limited to numeric and character strings."

I'll add that tidbit to the Porting Guide for ifort Users to ifx

0 Kudos
John_Michalakes
694 Views

Thanks all for following up.  For what it's worth, write(*,*) and print* are analogous.  But I'm in good shape, now that I know the rule. 

Also FWIW, I think output of numeric and character strings to stdout from print and write(*,*) is all that the Nvidia compiler supports from an offload region.

0 Kudos
jimdempseyatthecove
Honored Contributor III
685 Views

Barbara,

What about

    PRINT '("Value=",F6.2)', 123.456

 

(my oneAPI system is not fired up)

Jim Dempsey

0 Kudos
jimdempseyatthecove
Honored Contributor III
681 Views

Or

    WRITE(CharacterVariable, '("Value=",F6.2)') 123.456

 

Jim Dempsey

0 Kudos
Barbara_P_Intel
Moderator
674 Views

Doesn't look like it inside an OpenMP TARGET region.

+ ifx -qopenmp -fopenmp-targets=spir64 snippet.f90
snippet.f90(7): error #8945: Generalized I/O not supported in an offload region.
PRINT '("Value=",F6.2)', 123.456
^
snippet.f90(8): error #8945: Generalized I/O not supported in an offload region.
WRITE(CharacterVariable, '("Value=",F6.2)') 123.456
^
compilation aborted for snippet.f90 (code 1)

 

 

0 Kudos
Reply