Skip to content

Commit 2d57d3d

Browse files
Rename qv_scope_taskid() to qv_scope_group_rank(). (#261)
Signed-off-by: Samuel K. Gutierrez <[email protected]>
1 parent c787384 commit 2d57d3d

11 files changed

+58
-87
lines changed

include/quo-vadis.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ qv_scope_nobjs(
177177
*
178178
*/
179179
int
180-
qv_scope_taskid(
180+
qv_scope_group_rank(
181181
qv_scope_t *scope,
182182
int *rank
183183
);

src/fortran/quo-vadisf.f90

+6-6
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,13 @@ function qv_scope_nobjs_c(scope, obj, n) &
188188
end function qv_scope_nobjs_c
189189

190190
integer(c_int) &
191-
function qv_scope_taskid_c(scope, taskid) &
192-
bind(c, name='qv_scope_taskid')
191+
function qv_scope_group_rank_c(scope, taskid) &
192+
bind(c, name='qv_scope_group_rank')
193193
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
194194
implicit none
195195
type(c_ptr), value :: scope
196196
integer(c_int), intent(out) :: taskid
197-
end function qv_scope_taskid_c
197+
end function qv_scope_group_rank_c
198198

199199
integer(c_int) &
200200
function qv_scope_ntasks_c(scope, ntasks) &
@@ -341,14 +341,14 @@ subroutine qv_scope_nobjs(scope, obj, n, info)
341341
info = qv_scope_nobjs_c(scope, obj, n)
342342
end subroutine qv_scope_nobjs
343343

344-
subroutine qv_scope_taskid(scope, taskid, info)
344+
subroutine qv_scope_group_rank(scope, taskid, info)
345345
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
346346
implicit none
347347
type(c_ptr), value :: scope
348348
integer(c_int), intent(out) :: taskid
349349
integer(c_int), intent(out) :: info
350-
info = qv_scope_taskid_c(scope, taskid)
351-
end subroutine qv_scope_taskid
350+
info = qv_scope_group_rank_c(scope, taskid)
351+
end subroutine qv_scope_group_rank
352352

353353
subroutine qv_scope_ntasks(scope, ntasks, info)
354354
use, intrinsic :: iso_c_binding, only: c_ptr, c_int

src/quo-vadis.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,8 @@ qv_scope_nobjs(
104104
qvi_catch_and_return();
105105
}
106106

107-
// TODO(skg) Rename to qv_scope_group_rank.
108107
int
109-
qv_scope_taskid(
108+
qv_scope_group_rank(
110109
qv_scope_t *scope,
111110
int *rank
112111
) {

tests/qvi-test-common.h

+14-42
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ qvi_test_scope_report(
7575

7676
const int pid = qvi_test_gettid();
7777

78-
int taskid;
79-
int rc = qv_scope_taskid(scope, &taskid);
78+
int sgrank;
79+
int rc = qv_scope_group_rank(scope, &sgrank);
8080
if (rc != QV_SUCCESS) {
81-
ers = "qv_scope_taskid() failed";
81+
ers = "qv_scope_group_rank() failed";
8282
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
8383
}
8484

@@ -90,9 +90,9 @@ qvi_test_scope_report(
9090
}
9191

9292
printf(
93-
"[%d] %s taskid is %d\n"
93+
"[%d] %s sgrank is %d\n"
9494
"[%d] %s ntasks is %d\n",
95-
pid, scope_name, taskid,
95+
pid, scope_name, sgrank,
9696
pid, scope_name, ntasks
9797
);
9898

@@ -113,21 +113,12 @@ qvi_test_bind_push(
113113
char const *ers = NULL;
114114
const int pid = qvi_test_gettid();
115115

116-
int taskid;
117-
int rc = qv_scope_taskid(scope, &taskid);
116+
int sgrank;
117+
int rc = qv_scope_group_rank(scope, &sgrank);
118118
if (rc != QV_SUCCESS) {
119-
ers = "qv_scope_taskid() failed";
119+
ers = "qv_scope_group_rank() failed";
120120
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
121121
}
122-
123-
if (getenv("HWLOC_XMLFILE")) {
124-
if (taskid == 0) {
125-
printf("*** Using synthetic topology. "
126-
"Skipping change_bind tests. ***\n");
127-
}
128-
return;
129-
}
130-
131122
// Get current binding.
132123
char *bind0s;
133124
rc = qv_scope_bind_string(scope, QV_BIND_STRING_AS_LIST, &bind0s);
@@ -168,21 +159,12 @@ qvi_test_bind_pop(
168159

169160
const int pid = qvi_test_gettid();
170161

171-
int taskid;
172-
int rc = qv_scope_taskid(scope, &taskid);
162+
int sgrank;
163+
int rc = qv_scope_group_rank(scope, &sgrank);
173164
if (rc != QV_SUCCESS) {
174-
ers = "qv_scope_taskid() failed";
165+
ers = "qv_scope_group_rank() failed";
175166
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
176167
}
177-
178-
if (getenv("HWLOC_XMLFILE")) {
179-
if (taskid == 0) {
180-
printf("*** Using synthetic topology. "
181-
"Skipping change_bind tests. ***\n");
182-
}
183-
return;
184-
}
185-
186168
// Get current binding.
187169
char *bind0s;
188170
rc = qv_scope_bind_string(scope, QV_BIND_STRING_AS_LIST, &bind0s);
@@ -198,7 +180,6 @@ qvi_test_bind_pop(
198180
ers = "qv_bind_push() failed";
199181
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
200182
}
201-
202183
// Get new, current binding.
203184
char *bind1s;
204185
rc = qv_scope_bind_string(scope, QV_BIND_STRING_AS_LIST, &bind1s);
@@ -224,21 +205,12 @@ qvi_test_change_bind(
224205

225206
const int pid = qvi_test_gettid();
226207

227-
int taskid;
228-
int rc = qv_scope_taskid(scope, &taskid);
208+
int sgrank;
209+
int rc = qv_scope_group_rank(scope, &sgrank);
229210
if (rc != QV_SUCCESS) {
230-
ers = "qv_scope_taskid() failed";
211+
ers = "qv_scope_group_rank() failed";
231212
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
232213
}
233-
234-
if (getenv("HWLOC_XMLFILE")) {
235-
if (taskid == 0) {
236-
printf("*** Using synthetic topology. "
237-
"Skipping change_bind tests. ***\n");
238-
}
239-
return;
240-
}
241-
242214
// Get current binding.
243215
char *bind0s;
244216
rc = qv_scope_bind_string(scope, QV_BIND_STRING_AS_LIST, &bind0s);

tests/test-mpi-fortapi.f90

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ program mpi_fortapi
1919

2020

2121
integer(c_int) info, n
22-
integer(c_int) ntasks, taskid, n_cores, n_gpu
22+
integer(c_int) ntasks, sgrank, n_cores, n_gpu
2323
integer(c_int) vmajor, vminor, vpatch
2424
integer cwrank, cwsize, scope_comm, scope_comm_size
2525
type(c_ptr) scope_user, sub_scope
@@ -82,19 +82,19 @@ program mpi_fortapi
8282
end if
8383
print *, 'ntasks', ntasks
8484

85-
call qv_scope_taskid(scope_user, taskid, info)
85+
call qv_scope_group_rank(scope_user, sgrank, info)
8686
if (info .ne. QV_SUCCESS) then
8787
error stop
8888
end if
89-
print *, 'taskid', taskid
89+
print *, 'sgrank', sgrank
9090

9191
call qv_scope_nobjs(scope_user, QV_HW_OBJ_CORE, n_cores, info)
9292
if (info .ne. QV_SUCCESS) then
9393
error stop
9494
end if
9595
print *, 'ncores', n_cores
9696

97-
call qv_scope_split(scope_user, 2, taskid, sub_scope, info)
97+
call qv_scope_split(scope_user, 2, sgrank, sub_scope, info)
9898

9999
call qv_scope_bind_push(sub_scope, info)
100100
if (info .ne. QV_SUCCESS) then

tests/test-mpi-phases.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ main(
216216
printf("\n===Phase 2: NUMA split===\n");
217217

218218
#if 1
219-
int nnumas, my_numa_id;
219+
int nnumas, my_numa_rank;
220220
qv_scope_t *numa_scope;
221221

222222
/* Get the number of NUMA domains so that we can
@@ -248,17 +248,17 @@ main(
248248
}
249249

250250
/* Allow selecting a leader per NUMA */
251-
rc = qv_scope_taskid(
251+
rc = qv_scope_group_rank(
252252
numa_scope,
253-
&my_numa_id
253+
&my_numa_rank
254254
);
255255
if (rc != QV_SUCCESS) {
256-
ers = "qv_scope_taskid() failed";
256+
ers = "qv_scope_group_rank() failed";
257257
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
258258
}
259259

260260
printf("[%d]: #NUMAs=%d numa_scope_id=%d\n",
261-
wrank, nnumas, my_numa_id);
261+
wrank, nnumas, my_numa_rank);
262262

263263
rc = qv_scope_bind_push(numa_scope);
264264
if (rc != QV_SUCCESS) {
@@ -288,7 +288,7 @@ main(
288288

289289

290290
int npus;
291-
if (my_numa_id == 0) {
291+
if (my_numa_rank == 0) {
292292
/* I am the process lead */
293293
rc = qv_scope_nobjs(
294294
numa_scope,
@@ -339,7 +339,7 @@ main(
339339
if (wrank == 0)
340340
printf("\n===Phase 3: GPU split===\n");
341341

342-
int my_gpu_id;
342+
int my_gpu_rank;
343343
qv_scope_t *gpu_scope;
344344

345345
/* Get the number of GPUs so that we can
@@ -373,12 +373,12 @@ main(
373373
}
374374

375375
/* Allow selecting a leader per NUMA */
376-
rc = qv_scope_taskid(
376+
rc = qv_scope_group_rank(
377377
gpu_scope,
378-
&my_gpu_id
378+
&my_gpu_rank
379379
);
380380
if (rc != QV_SUCCESS) {
381-
ers = "qv_scope_taskid() failed";
381+
ers = "qv_scope_group_rank() failed";
382382
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
383383
}
384384

tests/test-mpi-scopes-affinity-preserving.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ main(
7171
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
7272
}
7373

74-
int base_scope_id;
75-
rc = qv_scope_taskid(
74+
int base_scope_rank;
75+
rc = qv_scope_group_rank(
7676
base_scope,
77-
&base_scope_id
77+
&base_scope_rank
7878
);
7979
if (rc != QV_SUCCESS) {
80-
ers = "qv_scope_taskid() failed";
80+
ers = "qv_scope_group_rank() failed";
8181
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
8282
}
8383

tests/test-mpi-scopes.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ main(
100100
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
101101
}
102102

103-
int base_scope_id;
104-
rc = qv_scope_taskid(
103+
int base_scope_rank;
104+
rc = qv_scope_group_rank(
105105
base_scope,
106-
&base_scope_id
106+
&base_scope_rank
107107
);
108108
if (rc != QV_SUCCESS) {
109-
ers = "qv_scope_taskid() failed";
109+
ers = "qv_scope_group_rank() failed";
110110
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
111111
}
112112

@@ -124,7 +124,7 @@ main(
124124

125125
const int npieces = 2;
126126
const int gid = get_group_id(
127-
base_scope_id,
127+
base_scope_rank,
128128
base_scope_ntasks,
129129
npieces
130130
);
@@ -156,7 +156,7 @@ main(
156156
qvi_test_scope_report(sub_scope, "sub_scope");
157157
qvi_test_change_bind(sub_scope);
158158

159-
if (base_scope_id == 0) {
159+
if (base_scope_rank == 0) {
160160
qv_scope_t *create_scope;
161161
rc = qv_scope_create(
162162
sub_scope, QV_HW_OBJ_CORE,

tests/test-omp.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
typedef struct {
1212
qv_scope_t *scope;
1313
int size;
14-
int id;
14+
int sgrank;
1515
} scopei;
1616

1717
static void
@@ -48,9 +48,9 @@ scopei_fill(
4848
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
4949
}
5050

51-
rc = qv_scope_taskid(sinfo->scope, &sinfo->id);
51+
rc = qv_scope_group_rank(sinfo->scope, &sinfo->sgrank);
5252
if (rc != QV_SUCCESS) {
53-
ers = "qv_scope_taskid() failed";
53+
ers = "qv_scope_group_rank() failed";
5454
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
5555
}
5656
}
@@ -95,7 +95,7 @@ scopei_ep(
9595

9696
char *ers = NULL;
9797
int rc = qv_scope_split(
98-
pinfo.scope, 2, pinfo.id, &sinfo->scope
98+
pinfo.scope, 2, pinfo.sgrank, &sinfo->scope
9999
);
100100
if (rc != QV_SUCCESS) {
101101
ers = "qv_scope_split_at() failed";

tests/test-process-fortapi.f90

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ program process_fortapi
1818

1919

2020
integer(c_int) info, n
21-
integer(c_int) ntasks, taskid, n_cores, n_gpu
21+
integer(c_int) ntasks, sgrank, n_cores, n_gpu
2222
type(c_ptr) scope_user
2323
character(len=:),allocatable :: bstr(:)
2424
character(len=:),allocatable :: dev_pci(:)
@@ -35,11 +35,11 @@ program process_fortapi
3535
end if
3636
print *, 'ntasks', ntasks
3737

38-
call qv_scope_taskid(scope_user, taskid, info)
38+
call qv_scope_group_rank(scope_user, sgrank, info)
3939
if (info .ne. QV_SUCCESS) then
4040
error stop
4141
end if
42-
print *, 'taskid', taskid
42+
print *, 'sgrank', sgrank
4343

4444
call qv_scope_nobjs(scope_user, QV_HW_OBJ_CORE, n_cores, info)
4545
if (info .ne. QV_SUCCESS) then

tests/test-process-scopes.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ main(void)
5353

5454
qvi_test_scope_report(base_scope, "base_scope");
5555

56-
int taskid;
57-
rc = qv_scope_taskid(base_scope, &taskid);
56+
int srank;
57+
rc = qv_scope_group_rank(base_scope, &srank);
5858
if (rc != QV_SUCCESS) {
59-
ers = "qv_scope_taskid() failed";
59+
ers = "qv_scope_group_rank() failed";
6060
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
6161
}
62-
if (taskid != 0) {
62+
if (srank != 0) {
6363
ers = "Invalid task ID detected";
6464
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
6565
}
@@ -88,7 +88,7 @@ main(void)
8888
const int npieces = 2;
8989
qv_scope_t *sub_scope;
9090
rc = qv_scope_split(
91-
base_scope, npieces, taskid, &sub_scope
91+
base_scope, npieces, srank, &sub_scope
9292
);
9393
if (rc != QV_SUCCESS) {
9494
ers = "qv_scope_split() failed";

0 commit comments

Comments
 (0)