-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split imperfect-loop-collapse into usm/non-usm variants
This patch splits the smoke-fails/imperfect-loop-collapse test into two variants, one of which does and one which doesn't need unified shared memory (which is orthogonal to the main purpose of the test). It also fixes the HSA_XNACK setting for smoke-fails/imperfect-loop-collapse-usm version, so both versions now work.
- Loading branch information
Showing
4 changed files
with
63 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
include ../../Makefile.defs | ||
|
||
TESTNAME = imperfect_loop_collapse_usm | ||
TESTSRC_MAIN = imperfect_loop_collapse_usm.cpp | ||
TESTSRC_AUX = | ||
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX) | ||
|
||
CLANG ?= clang++ | ||
OMP_BIN = $(AOMP)/bin/$(CLANG) | ||
CC = $(OMP_BIN) $(VERBOSE) | ||
|
||
HSA_XNACK ?= 1 | ||
SUPPORTED = $(SUPPORTS_USM) | ||
|
||
# Our "run" target gets overridden. Make sure we run with HSA_XNACK set | ||
# appropriately. | ||
RUNENV += HSA_XNACK=${HSA_XNACK} | ||
|
||
#-ccc-print-phases | ||
#"-\#\#\#" | ||
|
||
include ../Makefile.rules | ||
|
||
run: | ||
HSA_XNACK=${HSA_XNACK} ./$(TESTNAME) |
35 changes: 35 additions & 0 deletions
35
test/smoke-fails/imperfect-loop-collapse-usm/imperfect_loop_collapse_usm.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include<cstdio> | ||
|
||
#define N 1024 | ||
|
||
#pragma omp requires unified_shared_memory | ||
|
||
int main() { | ||
double *a = new double[N*N]; | ||
|
||
#pragma omp parallel for collapse(2) | ||
for(int i = 0; i < N; i++) | ||
for(int j = 0; j < N; j++) | ||
a[i*N+j] = (double) (i*N+j); | ||
|
||
#pragma omp target teams distribute parallel for collapse(2) | ||
for(int i = 0; i < N; i++) { | ||
double k = i*3.14; | ||
for(int j = 0; j < N; j++) | ||
a[i*N+j] += k; | ||
} | ||
|
||
//check | ||
int err = 0; | ||
for(int i = 0; i < N; i++) { | ||
double k = i*3.14; | ||
for(int j = 0; j < N; j++) | ||
if (a[i*N+j] != (double) (i*N+j) + k) { | ||
err++; | ||
printf("Error at (%d,%d): got %lf expected %lf\n", i, j, a[i*N+j], (double) (i*N+j) + k); | ||
if (err > 10) return err; | ||
} | ||
} | ||
|
||
return err; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters