Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] - Updates for virtual environment support #1235

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/smoke/omp_places/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ CC = $(OMP_BIN) $(VERBOSE)
#-ccc-print-phases
#"-\#\#\#"i

UNSUPPORTED = ISVIRT_RUNTIME

RUNENV += OMP_AFFINITY_FORMAT="Thread num: %n Affinity: %A" OMP_DISPLAY_AFFINITY=TRUE
RUNENV1 += $(RUNENV) OMP_PLACES="{0,1,2,3},{4,5,6,7},{8,9,10,11},{12,13,14,15}"
RUNENV2 += $(RUNENV) OMP_PLACES="{0:4},{4:4},{8:4},{12:4}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,22 @@ int main() {
int team_id;
int team_counts[TOTAL_TEAMS];
int *a = (int *)malloc(n*sizeof(int));
int nteams = 0;

for (int i = 0; i < TOTAL_TEAMS; i++)
team_counts[i] = 0;
// Check requested teams
#pragma omp teams num_teams(TOTAL_TEAMS)
nteams = omp_get_num_teams();

#pragma omp teams distribute num_teams(TOTAL_TEAMS) private(team_id)
if (nteams == 0){
printf("Error: Cannot determine number of teams.\n");
return 1;
} else if (nteams != TOTAL_TEAMS)
printf("Warning: Requested Teams was %d, but %d was used.\n", TOTAL_TEAMS, nteams);

for (int i = 0; i < nteams; i++)
team_counts[i] = 0;

#pragma omp teams distribute num_teams(nteams) private(team_id)
for(int i = 0; i < n; i++) {
team_id = omp_get_team_num();
a[i] = i;
Expand All @@ -28,8 +39,8 @@ int main() {
}
}

for (int i = 0; i < TOTAL_TEAMS; i++) {
if (team_counts[i] != N/TOTAL_TEAMS) {
for (int i = 0; i < nteams; i++) {
if (team_counts[i] != N/nteams) {
printf("Team id : %d is not shared with equal work. It is shared"
" with %d iterations\n", i, team_counts[i]);
err++;
Expand Down