diff --git a/include/quo-vadis.h b/include/quo-vadis.h index fb847ca..debc5d1 100644 --- a/include/quo-vadis.h +++ b/include/quo-vadis.h @@ -177,7 +177,7 @@ qv_scope_nobjs( * */ int -qv_scope_taskid( +qv_scope_group_rank( qv_scope_t *scope, int *rank ); diff --git a/src/fortran/quo-vadisf.f90 b/src/fortran/quo-vadisf.f90 index a541da2..bf73e47 100644 --- a/src/fortran/quo-vadisf.f90 +++ b/src/fortran/quo-vadisf.f90 @@ -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) & @@ -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 diff --git a/src/quo-vadis.cc b/src/quo-vadis.cc index 452de8b..470237d 100644 --- a/src/quo-vadis.cc +++ b/src/quo-vadis.cc @@ -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 ) { diff --git a/tests/qvi-test-common.h b/tests/qvi-test-common.h index 3a2e595..8a76bb2 100644 --- a/tests/qvi-test-common.h +++ b/tests/qvi-test-common.h @@ -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)); } @@ -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 ); @@ -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); @@ -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); @@ -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); @@ -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); diff --git a/tests/test-mpi-fortapi.f90 b/tests/test-mpi-fortapi.f90 index b791e41..2aa5a95 100644 --- a/tests/test-mpi-fortapi.f90 +++ b/tests/test-mpi-fortapi.f90 @@ -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 @@ -82,11 +82,11 @@ 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 @@ -94,7 +94,7 @@ program mpi_fortapi 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 diff --git a/tests/test-mpi-phases.c b/tests/test-mpi-phases.c index 23cc809..b269df7 100644 --- a/tests/test-mpi-phases.c +++ b/tests/test-mpi-phases.c @@ -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 @@ -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) { @@ -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, @@ -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 @@ -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)); } diff --git a/tests/test-mpi-scopes-affinity-preserving.c b/tests/test-mpi-scopes-affinity-preserving.c index 20d119f..8cf4f37 100644 --- a/tests/test-mpi-scopes-affinity-preserving.c +++ b/tests/test-mpi-scopes-affinity-preserving.c @@ -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)); } diff --git a/tests/test-mpi-scopes.c b/tests/test-mpi-scopes.c index 2f21937..6cff956 100644 --- a/tests/test-mpi-scopes.c +++ b/tests/test-mpi-scopes.c @@ -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)); } @@ -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 ); @@ -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, diff --git a/tests/test-omp.c b/tests/test-omp.c index 125952f..52824cf 100644 --- a/tests/test-omp.c +++ b/tests/test-omp.c @@ -11,7 +11,7 @@ typedef struct { qv_scope_t *scope; int size; - int id; + int sgrank; } scopei; static void @@ -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)); } } @@ -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"; diff --git a/tests/test-process-fortapi.f90 b/tests/test-process-fortapi.f90 index fdc8995..9439139 100644 --- a/tests/test-process-fortapi.f90 +++ b/tests/test-process-fortapi.f90 @@ -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(:) @@ -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 diff --git a/tests/test-process-scopes.c b/tests/test-process-scopes.c index 25a2288..c1be4e5 100644 --- a/tests/test-process-scopes.c +++ b/tests/test-process-scopes.c @@ -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)); } @@ -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";