From a2f76a0f51275df5773327e168bd90b61ce5244d Mon Sep 17 00:00:00 2001 From: bjpalmer Date: Fri, 13 Dec 2024 09:50:57 -0800 Subject: [PATCH] Capturing some debugging code. --- comex/src-mpi-pr/comex.c | 39 +++++----- global/testing/c_test.c | 151 +++++++++++++++++++++++++++++++++++---- 2 files changed, 158 insertions(+), 32 deletions(-) diff --git a/comex/src-mpi-pr/comex.c b/comex/src-mpi-pr/comex.c index 36cc5326..125a2ded 100644 --- a/comex/src-mpi-pr/comex.c +++ b/comex/src-mpi-pr/comex.c @@ -2804,13 +2804,13 @@ int comex_malloc(void *ptrs[], size_t size, comex_group_t group) reg_entries_local[reg_entries_local_count++] = reg_entries[i]; } } - // else if (g_state.hostid[reg_entries[i].rank] - // == g_state.hostid[my_world_rank]) + else if (g_state.hostid[reg_entries[i].rank] + == g_state.hostid[my_world_rank]) - else if (g_state.master[reg_entries[i].rank] == - g_state.master[get_my_master_rank_with_same_hostid(g_state.rank, - g_state.node_size, smallest_rank_with_same_hostid, largest_rank_with_same_hostid, - num_progress_ranks_per_node, is_node_ranks_packed)] ) +// else if (g_state.master[reg_entries[i].rank] == +// g_state.master[get_my_master_rank_with_same_hostid(g_state.rank, +// g_state.node_size, smallest_rank_with_same_hostid, largest_rank_with_same_hostid, +// num_progress_ranks_per_node, is_node_ranks_packed)] ) #if 0 #if MASTER_IS_SMALLEST_SMP_RANK else if (g_state.master[reg_entries[i].rank] == @@ -3215,6 +3215,9 @@ int comex_malloc_dev(void *ptrs[], size_t size, comex_group_t group) reg_entries_local[reg_entries_local_count++] = reg_entries[i]; } } +// else if (g_state.hostid[reg_entries[i].rank] +// == g_state.hostid[my_world_rank]) + /* my master is the same as the master of the notifier */ else if (g_state.master[reg_entries[i].rank] == g_state.master[get_my_master_rank_with_same_hostid(g_state.rank, @@ -7501,8 +7504,8 @@ STATIC void nb_put(void *src, void *dst, int bytes, int proc, nb_t *nb) if (COMEX_ENABLE_PUT_SMP) { /* put to SMP node */ - // if (g_state.hostid[proc] == g_state.hostid[g_state.rank]) - if (g_state.master[proc] == g_state.master[g_state.rank]) + if (g_state.hostid[proc] == g_state.hostid[g_state.rank]) +// if (g_state.master[proc] == g_state.master[g_state.rank]) { reg_entry_t *reg_entry = NULL; void *mapped_offset = NULL; @@ -7714,8 +7717,8 @@ STATIC void nb_get(void *src, void *dst, int bytes, int proc, nb_t *nb) if (COMEX_ENABLE_GET_SMP) { /* get from SMP node */ - // if (g_state.hostid[proc] == g_state.hostid[g_state.rank]) - if (g_state.master[proc] == g_state.master[g_state.rank]) + if (g_state.hostid[proc] == g_state.hostid[g_state.rank]) +// if (g_state.master[proc] == g_state.master[g_state.rank]) { reg_entry_t *reg_entry = NULL; void *mapped_offset = NULL; @@ -7905,8 +7908,8 @@ STATIC void nb_acc(int datatype, void *scale, if (COMEX_ENABLE_ACC_SMP) { /* acc to same SMP node */ - // if (g_state.hostid[proc] == g_state.hostid[g_state.rank]) - if (g_state.master[proc] == g_state.master[g_state.rank]) + if (g_state.hostid[proc] == g_state.hostid[g_state.rank]) +// if (g_state.master[proc] == g_state.master[g_state.rank]) { reg_entry_t *reg_entry = NULL; void *mapped_offset = NULL; @@ -9585,8 +9588,8 @@ STATIC void nb_putv( } #endif } else if (COMEX_ENABLE_PUT_SMP && -// g_state.hostid[proc] == g_state.hostid[g_state.rank]) { - g_state.master[proc] == g_state.master[g_state.rank]) { + g_state.hostid[proc] == g_state.hostid[g_state.rank]) { +// g_state.master[proc] == g_state.master[g_state.rank]) { /* put to process on same SMP node */ int j; void **src; @@ -9918,8 +9921,8 @@ STATIC void nb_getv( #endif } else if (COMEX_ENABLE_GET_SMP && -// g_state.hostid[proc] == g_state.hostid[g_state.rank]) { - g_state.master[proc] == g_state.master[g_state.rank]) { + g_state.hostid[proc] == g_state.hostid[g_state.rank]) { +// g_state.master[proc] == g_state.master[g_state.rank]) { int j; void **src; void **dst; @@ -10237,8 +10240,8 @@ STATIC void nb_accv( #endif } else if (COMEX_ENABLE_PUT_SMP && -// g_state.hostid[proc] == g_state.hostid[g_state.rank]) { - g_state.master[proc] == g_state.master[g_state.rank]) { + g_state.hostid[proc] == g_state.hostid[g_state.rank]) { +// g_state.master[proc] == g_state.master[g_state.rank]) { if (fence_array[g_state.master[proc]]) { _fence_master(g_state.master[proc]); } diff --git a/global/testing/c_test.c b/global/testing/c_test.c index 1f184c53..5d99b495 100644 --- a/global/testing/c_test.c +++ b/global/testing/c_test.c @@ -166,7 +166,13 @@ void test_int_array(int on_device, int local_buf_on_device) double tbeg; double zero = 0.0; int ok; - + int me, lprocs, lpdx, lpdy; + + /* get local rank and default group size */ + me = GA_Nodeid(); + lprocs = GA_Nnodes(); + factor(lprocs,&lpdx,&lpdy); + printf("p[%d] lprocs: %d lpdx: %d lpdy: %d\n",wrank,lprocs,lpdx,lpdy); tput = 0.0; tget = 0.0; tacc = 0.0; @@ -182,29 +188,32 @@ void test_int_array(int on_device, int local_buf_on_device) ndim = 2; dims[0] = DIMSIZE; dims[1] = DIMSIZE; - xinc = DIMSIZE/pdx; - yinc = DIMSIZE/pdy; - ipx = rank%pdx; - ipy = (rank-ipx)/pdx; - isx = (ipx+1)%pdx; - isy = (ipy+1)%pdy; + xinc = DIMSIZE/lpdx; + yinc = DIMSIZE/lpdy; + ipx = me%lpdx; + ipy = (me-ipx)/lpdx; + isx = (ipx+1)%lpdx; + isy = (ipy+1)%lpdy; /* Guarantee some data exchange between nodes */ lo[0] = isx*xinc; lo[1] = isy*yinc; - if (isx= grp_size) { + if (me == 0) printf(" Testing operations on group 2\n"); +#if 0 + if (me == 0) printf(" Group 2: Testing integer array on" + " device, local buffer on host\n"); + test_int_array(1,0); + print_bw(); + + if (me == 0) printf(" Group 2: Testing integer array on" + " device, local buffer on device\n"); + test_int_array(1,local_buf_on_device); + print_bw(); + +#endif + if (me == 0) printf(" Group 2: Testing integer array on" + " host, local buffer on host\n"); + test_int_array(0,0); + print_bw(); + +#if 0 + if (me == 0) printf(" Group 2: Testing integer array on" + " host, local buffer on device\n"); + test_int_array(0,local_buf_on_device); + print_bw(); +#endif + } +#endif + } else { + printf("p[%d] Number of processors in group does not match" + " number of devices. Ndev: %d Grp_size: %d\n",rank,ndev,grp_size); + } + GA_Pgroup_set_default(world); + free(list); + } +#endif + + t_tot = GA_Wtime()-tbeg; /* Print out timing stats */ GA_Dgop(&t_put,1,"+");