Hi
I want to put OpenMP-directives and OpenACC-directives in one program.
In the OpenACC-program some OpenMP-directives shall be ignored (when there is an equivalent OpenACC-directive) but others shall be used (when the code has to run on CPU)
In the non-OpenAcc-program all OpenMP-directives shall be used.
I tried to opt out OpenMP by a define. The following example is minimalist:
#ifndef _OPENACC #define MYOMP !$OMP #else #define MYOMP C #endif PROGRAM MAIN OPTION EXPLICIT INTEGER a(1000),i MYOMP PARALLEL DO DO I=1,1000 a(i) = 0 END DO MYOMP END PARALLEL DO END Compile with ifort 15 on Windows: ifort test.for /openmp /fpp
The compiler/preprocessor removes the !$OMP-directive. Obviously its treats as a comment.
Any Advice?
Benedikt
Output of compiler: Intel(R) Visual Fortran Compiler XE for applications running on IA-32, Version 15.0.0.108 Build 20140726 Copyright (C) 1985-2014 Intel Corporation. All rights reserved. test.for(10): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ( % [ : . = => PARALLEL DO -----------------^ test.for(14): error #5082: Syntax error, found IDENTIFIER 'PARALLELDO' when expecting one of: <END-OF-STATEMENT> ; BLOCK PROGRAM BLOCKDATA MODULE TYPE FUNCTION SUBROUTINE ... END PARALLEL DO ----------^ test.for(14): error #8731: An END BLOCK occurred without a corresponding BLOCK statement. END PARALLEL DO ------^ test.for(10): error #6218: This statement is positioned incorrectly and/or has syntax errors. PARALLEL DO -----------------^ compilation aborted for test.for (code 1)