CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
232 lines
6.3 KiB
C++
232 lines
6.3 KiB
C++
#ifndef HEADER
|
|
#define HEADER
|
|
// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -verify %s
|
|
|
|
#define NNN 50
|
|
int aaa[NNN];
|
|
int aaa2[NNN][NNN];
|
|
|
|
void parallel_loop() {
|
|
#pragma omp parallel
|
|
{
|
|
#pragma omp loop
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa[j] = j*NNN;
|
|
}
|
|
}
|
|
|
|
#pragma omp parallel for
|
|
for (int i = 0 ; i < NNN ; i++) {
|
|
#pragma omp loop bind(parallel) // expected-error{{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp loop' directive into a parallel region?}}
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa2[i][j] = i+j;
|
|
}
|
|
}
|
|
|
|
#pragma omp parallel
|
|
#pragma omp for nowait
|
|
for (int i = 0 ; i < NNN ; i++) {
|
|
#pragma omp loop bind(parallel) // expected-error{{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp loop' directive into a parallel region?}}
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa2[i][j] = i+j;
|
|
}
|
|
}
|
|
|
|
#pragma omp parallel for
|
|
for (int i = 0 ; i < NNN ; i++) {
|
|
#pragma omp nothing
|
|
#pragma omp loop
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa2[i][j] = i+j;
|
|
}
|
|
}
|
|
|
|
#pragma omp target teams distribute parallel for
|
|
for (int i = 0 ; i < NNN ; i++) {
|
|
#pragma omp loop bind(parallel) // expected-error{{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp loop' directive into a parallel region?}}
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa2[i][j] = i+j;
|
|
}
|
|
}
|
|
|
|
#pragma omp target parallel
|
|
for (int i = 0 ; i < NNN ; i++) {
|
|
#pragma omp loop bind(parallel)
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa2[i][j] = i+j;
|
|
}
|
|
}
|
|
|
|
#pragma omp parallel for
|
|
for (int i = 0; i < 100; ++i) {
|
|
#pragma omp loop bind(parallel) // expected-error{{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp loop' directive into a parallel region?}}
|
|
for (int i = 0 ; i < NNN ; i++) {
|
|
#pragma omp loop bind(parallel) // expected-error{{region cannot be closely nested inside 'loop' region; perhaps you forget to enclose 'omp loop' directive into a parallel region?}}
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa[j] = j*NNN;
|
|
}
|
|
}
|
|
}
|
|
|
|
#pragma omp parallel
|
|
{
|
|
#pragma omp sections
|
|
{
|
|
for (int i = 0 ; i < NNN ; i++) {
|
|
#pragma omp loop bind(parallel) // expected-error{{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp loop' directive into a parallel region?}}
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa2[i][j] = i+j;
|
|
}
|
|
}
|
|
|
|
#pragma omp section
|
|
{
|
|
aaa[NNN-1] = NNN;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void teams_loop() {
|
|
int var1;
|
|
int total = 0;
|
|
|
|
#pragma omp teams
|
|
{
|
|
#pragma omp loop bind(teams)
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa[j] = j*NNN;
|
|
}
|
|
|
|
#pragma omp loop bind(teams) collapse(2) private(var1)
|
|
for (int i = 0 ; i < 3 ; i++) {
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
var1 += aaa[j];
|
|
}
|
|
}
|
|
}
|
|
|
|
#pragma omp target teams
|
|
for (int i = 0 ; i < NNN ; i++) {
|
|
#pragma omp loop bind(teams)
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa2[i][j] = i+j;
|
|
}
|
|
}
|
|
|
|
#pragma omp target teams distribute parallel for
|
|
for (int i = 0 ; i < NNN ; i++) {
|
|
#pragma omp loop bind(teams) // expected-error{{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp loop' directive into a teams region?}}
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa2[i][j] = i+j;
|
|
}
|
|
}
|
|
|
|
#pragma omp teams
|
|
{
|
|
#pragma omp loop bind(teams)
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa[j] = j*NNN;
|
|
}
|
|
|
|
#pragma omp loop bind(teams) reduction(+:total) // expected-error{{'reduction' clause not allowed with '#pragma omp loop bind(teams)'}}
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
total+=aaa[j];
|
|
}
|
|
}
|
|
|
|
#pragma omp teams num_teams(8) thread_limit(256)
|
|
#pragma omp distribute parallel for dist_schedule(static, 1024) \
|
|
schedule(static, 64)
|
|
for (int i = 0; i < NNN; i++) {
|
|
#pragma omp loop bind(teams) // expected-error{{'distribute parallel for' region; perhaps you forget to enclose 'omp loop' directive into a teams region?}}
|
|
for (int j = 0; j < NNN; j++) {
|
|
aaa2[i][j] = i+j;
|
|
}
|
|
}
|
|
|
|
#pragma omp teams
|
|
for (int i = 0; i < NNN; i++) {
|
|
#pragma omp loop bind(thread)
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa[i] = i+i*NNN;
|
|
}
|
|
}
|
|
|
|
#pragma omp teams loop
|
|
for (int i = 0; i < NNN; i++) {
|
|
#pragma omp loop
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa[i] = i+i*NNN;
|
|
}
|
|
}
|
|
|
|
#pragma omp teams loop
|
|
for (int i = 0; i < NNN; i++) {
|
|
#pragma omp loop bind(teams) // expected-error{{region cannot be closely nested inside 'teams loop' region; perhaps you forget to enclose 'omp loop' directive into a teams region?}}
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa[i] = i+i*NNN;
|
|
}
|
|
}
|
|
}
|
|
|
|
void thread_loop() {
|
|
#pragma omp parallel
|
|
for (int i = 0; i < NNN; i++) {
|
|
#pragma omp loop bind(thread)
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa[i] = i+i*NNN;
|
|
}
|
|
}
|
|
|
|
#pragma omp teams
|
|
for (int i = 0; i < NNN; i++) {
|
|
#pragma omp loop bind(thread)
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa[i] = i+i*NNN;
|
|
}
|
|
}
|
|
}
|
|
|
|
void parallel_for_with_loop_teams_bind(){
|
|
#pragma omp parallel for
|
|
for (int i = 0; i < NNN; i++) {
|
|
#pragma omp loop bind(teams) // expected-error{{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp loop' directive into a teams region?}}
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa[i] = i+i*NNN;
|
|
}
|
|
}
|
|
}
|
|
|
|
void orphan_loops() {
|
|
#pragma omp loop // expected-error{{expected 'bind' clause for 'loop' construct without an enclosing OpenMP construct}}
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa[j] = j*NNN;
|
|
}
|
|
|
|
#pragma omp loop bind(parallel)
|
|
for (int j = 0 ; j < NNN ; j++) {
|
|
aaa[j] = j*NNN;
|
|
}
|
|
|
|
#pragma omp loop bind(teams)
|
|
for (int i = 0; i < NNN; i++) {
|
|
aaa[i] = i+i*NNN;
|
|
}
|
|
|
|
#pragma omp loop bind(thread)
|
|
for (int i = 0; i < NNN; i++) {
|
|
aaa[i] = i+i*NNN;
|
|
}
|
|
}
|
|
|
|
int main(int argc, char *argv[]) {
|
|
parallel_loop();
|
|
teams_loop();
|
|
thread_loop();
|
|
parallel_for_with_loop_teams_bind();
|
|
orphan_loops();
|
|
}
|
|
|
|
#endif
|