public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111691] New: [OpenMP][5.2] C/C++ handle 'omp declare variant([base–name:]variant-name)' - i.e. with 'base-name'
@ 2023-10-04  9:35 burnus at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: burnus at gcc dot gnu.org @ 2023-10-04  9:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111691

            Bug ID: 111691
           Summary: [OpenMP][5.2] C/C++ handle 'omp declare
                    variant([base–name:]variant-name)' - i.e. with
                    'base-name'
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: openmp, rejects-valid
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

OpenMP 5.2 has:
  omp declare variant([base–name:]variant-name)

for C/C++/Fortran; in OpenMP 5.1, the 'base-name:' was Fortran, only.

(Example loosely based on
https://github.com/SOLLVE/sollve_vv/blob/master/tests/5.1/declare_variant/test_begin_end_declare_variant.c
)



It seems as if the following should be valid:

void add(int *arr){
   for (int i = 0; i < N; i++){ // Base function adds 1 to array values
      arr[i] = i+1;
   }
}

#pragma omp begin declare variant match(construct={parallel})
void add(int *arr){
   #pragma omp for
   for (int i = 0; i < N; i++){
      arr[i] = i + 2;
   } 
}

void add_my(int *arr){
   #pragma omp for
   for (int i = 0; i < N; i++){
      arr[i] = i + 3;
   }
}
#pragma omp declare variant(add : add_my) match(construct={target})

#pragma omp end declare variant  // Note: delimited declare variant ending
here!

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-10-04  9:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-04  9:35 [Bug c/111691] New: [OpenMP][5.2] C/C++ handle 'omp declare variant([base–name:]variant-name)' - i.e. with 'base-name' burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).