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

Rename qv_scope_taskid() to qv_scope_group_rank(). #261

Merged
merged 1 commit into from
Jul 28, 2024
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: 1 addition & 1 deletion include/quo-vadis.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ qv_scope_nobjs(
*
*/
int
qv_scope_taskid(
qv_scope_group_rank(
qv_scope_t *scope,
int *rank
);
Expand Down
12 changes: 6 additions & 6 deletions src/fortran/quo-vadisf.f90
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@ function qv_scope_nobjs_c(scope, obj, n) &
end function qv_scope_nobjs_c

integer(c_int) &
function qv_scope_taskid_c(scope, taskid) &
bind(c, name='qv_scope_taskid')
function qv_scope_group_rank_c(scope, taskid) &
bind(c, name='qv_scope_group_rank')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: scope
integer(c_int), intent(out) :: taskid
end function qv_scope_taskid_c
end function qv_scope_group_rank_c

integer(c_int) &
function qv_scope_ntasks_c(scope, ntasks) &
Expand Down Expand Up @@ -341,14 +341,14 @@ subroutine qv_scope_nobjs(scope, obj, n, info)
info = qv_scope_nobjs_c(scope, obj, n)
end subroutine qv_scope_nobjs

subroutine qv_scope_taskid(scope, taskid, info)
subroutine qv_scope_group_rank(scope, taskid, info)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: scope
integer(c_int), intent(out) :: taskid
integer(c_int), intent(out) :: info
info = qv_scope_taskid_c(scope, taskid)
end subroutine qv_scope_taskid
info = qv_scope_group_rank_c(scope, taskid)
end subroutine qv_scope_group_rank

subroutine qv_scope_ntasks(scope, ntasks, info)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
Expand Down
3 changes: 1 addition & 2 deletions src/quo-vadis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ qv_scope_nobjs(
qvi_catch_and_return();
}

// TODO(skg) Rename to qv_scope_group_rank.
int
qv_scope_taskid(
qv_scope_group_rank(
qv_scope_t *scope,
int *rank
) {
Expand Down
56 changes: 14 additions & 42 deletions tests/qvi-test-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ qvi_test_scope_report(

const int pid = qvi_test_gettid();

int taskid;
int rc = qv_scope_taskid(scope, &taskid);
int sgrank;
int rc = qv_scope_group_rank(scope, &sgrank);
if (rc != QV_SUCCESS) {
ers = "qv_scope_taskid() failed";
ers = "qv_scope_group_rank() failed";
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}

Expand All @@ -90,9 +90,9 @@ qvi_test_scope_report(
}

printf(
"[%d] %s taskid is %d\n"
"[%d] %s sgrank is %d\n"
"[%d] %s ntasks is %d\n",
pid, scope_name, taskid,
pid, scope_name, sgrank,
pid, scope_name, ntasks
);

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

int taskid;
int rc = qv_scope_taskid(scope, &taskid);
int sgrank;
int rc = qv_scope_group_rank(scope, &sgrank);
if (rc != QV_SUCCESS) {
ers = "qv_scope_taskid() failed";
ers = "qv_scope_group_rank() failed";
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}

if (getenv("HWLOC_XMLFILE")) {
if (taskid == 0) {
printf("*** Using synthetic topology. "
"Skipping change_bind tests. ***\n");
}
return;
}

// Get current binding.
char *bind0s;
rc = qv_scope_bind_string(scope, QV_BIND_STRING_AS_LIST, &bind0s);
Expand Down Expand Up @@ -168,21 +159,12 @@ qvi_test_bind_pop(

const int pid = qvi_test_gettid();

int taskid;
int rc = qv_scope_taskid(scope, &taskid);
int sgrank;
int rc = qv_scope_group_rank(scope, &sgrank);
if (rc != QV_SUCCESS) {
ers = "qv_scope_taskid() failed";
ers = "qv_scope_group_rank() failed";
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}

if (getenv("HWLOC_XMLFILE")) {
if (taskid == 0) {
printf("*** Using synthetic topology. "
"Skipping change_bind tests. ***\n");
}
return;
}

// Get current binding.
char *bind0s;
rc = qv_scope_bind_string(scope, QV_BIND_STRING_AS_LIST, &bind0s);
Expand All @@ -198,7 +180,6 @@ qvi_test_bind_pop(
ers = "qv_bind_push() failed";
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}

// Get new, current binding.
char *bind1s;
rc = qv_scope_bind_string(scope, QV_BIND_STRING_AS_LIST, &bind1s);
Expand All @@ -224,21 +205,12 @@ qvi_test_change_bind(

const int pid = qvi_test_gettid();

int taskid;
int rc = qv_scope_taskid(scope, &taskid);
int sgrank;
int rc = qv_scope_group_rank(scope, &sgrank);
if (rc != QV_SUCCESS) {
ers = "qv_scope_taskid() failed";
ers = "qv_scope_group_rank() failed";
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}

if (getenv("HWLOC_XMLFILE")) {
if (taskid == 0) {
printf("*** Using synthetic topology. "
"Skipping change_bind tests. ***\n");
}
return;
}

// Get current binding.
char *bind0s;
rc = qv_scope_bind_string(scope, QV_BIND_STRING_AS_LIST, &bind0s);
Expand Down
8 changes: 4 additions & 4 deletions tests/test-mpi-fortapi.f90
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ program mpi_fortapi


integer(c_int) info, n
integer(c_int) ntasks, taskid, n_cores, n_gpu
integer(c_int) ntasks, sgrank, n_cores, n_gpu
integer(c_int) vmajor, vminor, vpatch
integer cwrank, cwsize, scope_comm, scope_comm_size
type(c_ptr) scope_user, sub_scope
Expand Down Expand Up @@ -82,19 +82,19 @@ program mpi_fortapi
end if
print *, 'ntasks', ntasks

call qv_scope_taskid(scope_user, taskid, info)
call qv_scope_group_rank(scope_user, sgrank, info)
if (info .ne. QV_SUCCESS) then
error stop
end if
print *, 'taskid', taskid
print *, 'sgrank', sgrank

call qv_scope_nobjs(scope_user, QV_HW_OBJ_CORE, n_cores, info)
if (info .ne. QV_SUCCESS) then
error stop
end if
print *, 'ncores', n_cores

call qv_scope_split(scope_user, 2, taskid, sub_scope, info)
call qv_scope_split(scope_user, 2, sgrank, sub_scope, info)

call qv_scope_bind_push(sub_scope, info)
if (info .ne. QV_SUCCESS) then
Expand Down
20 changes: 10 additions & 10 deletions tests/test-mpi-phases.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ main(
printf("\n===Phase 2: NUMA split===\n");

#if 1
int nnumas, my_numa_id;
int nnumas, my_numa_rank;
qv_scope_t *numa_scope;

/* Get the number of NUMA domains so that we can
Expand Down Expand Up @@ -248,17 +248,17 @@ main(
}

/* Allow selecting a leader per NUMA */
rc = qv_scope_taskid(
rc = qv_scope_group_rank(
numa_scope,
&my_numa_id
&my_numa_rank
);
if (rc != QV_SUCCESS) {
ers = "qv_scope_taskid() failed";
ers = "qv_scope_group_rank() failed";
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}

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

rc = qv_scope_bind_push(numa_scope);
if (rc != QV_SUCCESS) {
Expand Down Expand Up @@ -288,7 +288,7 @@ main(


int npus;
if (my_numa_id == 0) {
if (my_numa_rank == 0) {
/* I am the process lead */
rc = qv_scope_nobjs(
numa_scope,
Expand Down Expand Up @@ -339,7 +339,7 @@ main(
if (wrank == 0)
printf("\n===Phase 3: GPU split===\n");

int my_gpu_id;
int my_gpu_rank;
qv_scope_t *gpu_scope;

/* Get the number of GPUs so that we can
Expand Down Expand Up @@ -373,12 +373,12 @@ main(
}

/* Allow selecting a leader per NUMA */
rc = qv_scope_taskid(
rc = qv_scope_group_rank(
gpu_scope,
&my_gpu_id
&my_gpu_rank
);
if (rc != QV_SUCCESS) {
ers = "qv_scope_taskid() failed";
ers = "qv_scope_group_rank() failed";
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}

Expand Down
8 changes: 4 additions & 4 deletions tests/test-mpi-scopes-affinity-preserving.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ main(
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}

int base_scope_id;
rc = qv_scope_taskid(
int base_scope_rank;
rc = qv_scope_group_rank(
base_scope,
&base_scope_id
&base_scope_rank
);
if (rc != QV_SUCCESS) {
ers = "qv_scope_taskid() failed";
ers = "qv_scope_group_rank() failed";
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}

Expand Down
12 changes: 6 additions & 6 deletions tests/test-mpi-scopes.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ main(
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}

int base_scope_id;
rc = qv_scope_taskid(
int base_scope_rank;
rc = qv_scope_group_rank(
base_scope,
&base_scope_id
&base_scope_rank
);
if (rc != QV_SUCCESS) {
ers = "qv_scope_taskid() failed";
ers = "qv_scope_group_rank() failed";
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}

Expand All @@ -124,7 +124,7 @@ main(

const int npieces = 2;
const int gid = get_group_id(
base_scope_id,
base_scope_rank,
base_scope_ntasks,
npieces
);
Expand Down Expand Up @@ -156,7 +156,7 @@ main(
qvi_test_scope_report(sub_scope, "sub_scope");
qvi_test_change_bind(sub_scope);

if (base_scope_id == 0) {
if (base_scope_rank == 0) {
qv_scope_t *create_scope;
rc = qv_scope_create(
sub_scope, QV_HW_OBJ_CORE,
Expand Down
8 changes: 4 additions & 4 deletions tests/test-omp.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
typedef struct {
qv_scope_t *scope;
int size;
int id;
int sgrank;
} scopei;

static void
Expand Down Expand Up @@ -48,9 +48,9 @@ scopei_fill(
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}

rc = qv_scope_taskid(sinfo->scope, &sinfo->id);
rc = qv_scope_group_rank(sinfo->scope, &sinfo->sgrank);
if (rc != QV_SUCCESS) {
ers = "qv_scope_taskid() failed";
ers = "qv_scope_group_rank() failed";
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}
}
Expand Down Expand Up @@ -95,7 +95,7 @@ scopei_ep(

char *ers = NULL;
int rc = qv_scope_split(
pinfo.scope, 2, pinfo.id, &sinfo->scope
pinfo.scope, 2, pinfo.sgrank, &sinfo->scope
);
if (rc != QV_SUCCESS) {
ers = "qv_scope_split_at() failed";
Expand Down
6 changes: 3 additions & 3 deletions tests/test-process-fortapi.f90
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ program process_fortapi


integer(c_int) info, n
integer(c_int) ntasks, taskid, n_cores, n_gpu
integer(c_int) ntasks, sgrank, n_cores, n_gpu
type(c_ptr) scope_user
character(len=:),allocatable :: bstr(:)
character(len=:),allocatable :: dev_pci(:)
Expand All @@ -35,11 +35,11 @@ program process_fortapi
end if
print *, 'ntasks', ntasks

call qv_scope_taskid(scope_user, taskid, info)
call qv_scope_group_rank(scope_user, sgrank, info)
if (info .ne. QV_SUCCESS) then
error stop
end if
print *, 'taskid', taskid
print *, 'sgrank', sgrank

call qv_scope_nobjs(scope_user, QV_HW_OBJ_CORE, n_cores, info)
if (info .ne. QV_SUCCESS) then
Expand Down
10 changes: 5 additions & 5 deletions tests/test-process-scopes.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ main(void)

qvi_test_scope_report(base_scope, "base_scope");

int taskid;
rc = qv_scope_taskid(base_scope, &taskid);
int srank;
rc = qv_scope_group_rank(base_scope, &srank);
if (rc != QV_SUCCESS) {
ers = "qv_scope_taskid() failed";
ers = "qv_scope_group_rank() failed";
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}
if (taskid != 0) {
if (srank != 0) {
ers = "Invalid task ID detected";
qvi_test_panic("%s (rc=%s)", ers, qv_strerr(rc));
}
Expand Down Expand Up @@ -88,7 +88,7 @@ main(void)
const int npieces = 2;
qv_scope_t *sub_scope;
rc = qv_scope_split(
base_scope, npieces, taskid, &sub_scope
base_scope, npieces, srank, &sub_scope
);
if (rc != QV_SUCCESS) {
ers = "qv_scope_split() failed";
Expand Down
Loading