Skip to content

Commit

Permalink
checkin changes to init-comm functionality. These may be unecessary.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruce J Palmer committed Nov 13, 2023
1 parent 6154261 commit 7a2badd
Show file tree
Hide file tree
Showing 26 changed files with 174 additions and 0 deletions.
6 changes: 6 additions & 0 deletions armci/src-gemini/armci.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ void ARMCI_Error(char *msg, int code)
armci_die(msg,code);
}

/* Define this function so that all codes compile */
int ARMCI_Active_rank()
{
return 1;
}


void armci_allocate_locks()
{
Expand Down
1 change: 1 addition & 0 deletions armci/src-gemini/armci.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ extern int armci_notify(int proc);
extern int armci_notify_wait(int proc,int *pval);
extern int ARMCI_Init(void); /* initialize ARMCI */
extern int ARMCI_Init_mpi_comm(MPI_Comm comm); /* initialize ARMCI */
extern int ARMCI_Active_rank();
extern int ARMCI_Init_args(int *argc, char ***argv);
extern void ARMCI_Barrier(void); /* ARMCI Barrier*/

Expand Down
6 changes: 6 additions & 0 deletions armci/src-portals/armci.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ void ARMCI_Error(char *msg, int code)
armci_die(msg,code);
}

/* Define this function so that all codes compile */
int ARMCI_Active_rank()
{
return 1;
}


void armci_allocate_locks()
{
Expand Down
1 change: 1 addition & 0 deletions armci/src-portals/armci.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ extern int armci_notify(int proc);
extern int armci_notify_wait(int proc,int *pval);
extern int ARMCI_Init(void); /* initialize ARMCI */
extern int ARMCI_Init_mpi_comm(MPI_Comm comm); /* initialize ARMCI */
extern int ARMCI_Active_rank();
extern int ARMCI_Init_args(int *argc, char ***argv);
extern void ARMCI_Barrier(void); /* ARMCI Barrier*/

Expand Down
8 changes: 8 additions & 0 deletions armci/src/common/armci.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,14 @@ void ARMCI_Error(char *msg, int code)
armci_die(msg,code);
}

/* This is used in some of the MPI-based runtimes to support initialization
* using a communicator. Include it here so all codes compile.
*/
int ARMCI_Active_rank()
{
return 1;
}



void armci_allocate_locks()
Expand Down
1 change: 1 addition & 0 deletions armci/src/include/armci.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ extern int ARMCI_Init(void); /* initialize ARMCI */
#ifdef MSG_COMMS_MPI
extern int ARMCI_Init_mpi_comm(MPI_Comm comm); /* initialize ARMCI */
#endif
extern int ARMCI_Active_rank();

extern int ARMCI_Init_args(int *argc, char ***argv); /* initialize ARMCI */
extern int ARMCI_Initialized();
Expand Down
4 changes: 4 additions & 0 deletions comex/src-armci/armci.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ int PARMCI_Initialized()
return comex_initialized();
}

int ARMCI_Active_rank()
{
return comex_active_rank();
}

void PARMCI_Lock(int mutex, int proc)
{
Expand Down
1 change: 1 addition & 0 deletions comex/src-armci/armci.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ extern int armci_notify_wait(int proc,int *pval);
extern int ARMCI_Init(); /* initialize ARMCI */
extern int ARMCI_Init_args(int *argc, char ***argv); /* initialize ARMCI */
extern int ARMCI_Init_mpi_comm(MPI_Comm comm); /* initialize ARMCI with external communicator */
extern int ARMCI_Active_rank();
extern int ARMCI_Initialized();
extern void ARMCI_Barrier(); /* ARMCI Barrier*/

Expand Down
11 changes: 11 additions & 0 deletions comex/src-common/comex.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ extern int comex_init_args(int *argc, char ***argv);
*/
extern int comex_init_comm(MPI_Comm);

/**
* Returns status of rank with respect to user visibility.
* This function is true if this rank is visible to the
* application, false otherwise. Used in conjunction with
* comex_init_comm.
*
* @return 1 if rank is visible to application
* 0 otherwise
*/
extern int comex_active_rank();

/**
* Test whether comex has been initialized.
*
Expand Down
5 changes: 5 additions & 0 deletions comex/src-dmapp/comex.c
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,11 @@ int comex_init_comm(MPI_Comm comm)
return _comex_init(comm);
}

int comex_active_rank()
{
return 1;
}


int comex_init_args(int *argc, char ***argv)
{
Expand Down
5 changes: 5 additions & 0 deletions comex/src-mpi-mt/comex.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@ int comex_init_comm(MPI_Comm comm)
return _comex_init(comm);
}

int comex_active_rank()
{
return 1;
}


int comex_init_args(int *argc, char ***argv)
{
Expand Down
5 changes: 5 additions & 0 deletions comex/src-mpi-pr/comex.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,11 @@ int comex_init_comm(MPI_Comm comm)
return _comex_init(comm);
}

int comex_active_rank()
{
return g_state.master[g_state.rank] != g_state.rank ? 1 : 0;
}


int comex_init_args(int *argc, char ***argv)
{
Expand Down
5 changes: 5 additions & 0 deletions comex/src-mpi-pt/comex.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,11 @@ int comex_init_comm(MPI_Comm comm)
return _comex_init(comm);
}

int comex_active_rank()
{
return g_state.master[g_state.rank] != g_state.rank ? 1 : 0;
}


int comex_init_args(int *argc, char ***argv)
{
Expand Down
5 changes: 5 additions & 0 deletions comex/src-mpi/comex.c
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,11 @@ int comex_init_comm(MPI_Comm comm)
return _comex_init(comm);
}

int comex_init_comm()
{
return 1;
}


int comex_init_args(int *argc, char ***argv)
{
Expand Down
5 changes: 5 additions & 0 deletions comex/src-mpi3/comex.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@ int comex_init_comm(MPI_Comm comm)
return _comex_init(comm);
}

int comex_active_rank()
{
return 1;
}


int comex_init_args(int *argc, char ***argv)
{
Expand Down
5 changes: 5 additions & 0 deletions comex/src-ofa/comex.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ int comex_init_comm(MPI_Comm comm)
return _comex_init(comm);
}

int comex_active_rank()
{
return 1;
}

int comex_init_args(int *argc, char ***argv)
{
int rc;
Expand Down
5 changes: 5 additions & 0 deletions comex/src-ofi/comex.c
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,11 @@ int comex_init_comm(MPI_Comm comm)
return _comex_init(comm);
}

int comex_active_rank()
{
return 1;
}

int comex_init_args(int* argc, char*** argv)
{
int init_flag;
Expand Down
4 changes: 4 additions & 0 deletions comex/src-portals4/comex.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ int comex_init_comm(MPI_Comm comm)
return _comex_init(comm);
}

int return comex_active_rank()
{
return 1;
}

int comex_init_args(int *argc, char ***argv)
{
Expand Down
42 changes: 42 additions & 0 deletions comex/src-template/comex.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,48 @@ int comex_init_args(int *argc, char ***argv)
return comex_init();
}

int comex_init_comm(MPI_Comm comm)
{
int status;

if (initialized) {
return 0;
}
initialized = 1;

/* Assert MPI has been initialized */
int init_flag;
status = MPI_Initialized(&init_flag);
assert(MPI_SUCCESS == status);
assert(init_flag);

/* Duplicate the World Communicator */
status = MPI_Comm_dup(comm, &(l_state.world_comm));
assert(MPI_SUCCESS == status);
assert(l_state.world_comm);

/* My Rank */
status = MPI_Comm_rank(l_state.world_comm, &(l_state.rank));
assert(MPI_SUCCESS == status);

/* World Size */
status = MPI_Comm_size(l_state.world_comm, &(l_state.size));
assert(MPI_SUCCESS == status);

/* groups */
comex_group_init();

/* Synch - Sanity Check */
MPI_Barrier(l_state.world_comm);

return COMEX_SUCCESS;
}

int comex_active_rank()
{
return 1;
}


int comex_initialized()
{
Expand Down
12 changes: 12 additions & 0 deletions global/src/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,18 @@ int pnga_initialize_comm(MPI_Comm comm)
}
#endif

/**
* Return status of processor with respect to visibility to user application.
* This function returns 1 if application can see this processor, 0 otherwise.
*/
#if HAVE_SYS_WEAK_ALIAS_PRAGMA
# pragma weak wnga_active_rank = pnga_active_rank
#endif
logical pnga_active_rank()
{
return ARMCI_Active_rank();
}

#if HAVE_SYS_WEAK_ALIAS_PRAGMA
# pragma weak wnga_initialized = pnga_initialized
#endif
Expand Down
10 changes: 10 additions & 0 deletions global/src/capi.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,16 @@ int NGA_Initialize_comm(MPI_Comm comm)
return wnga_initialize_comm(comm);
}

int GA_Active_rank()
{
return wnga_active_rank();
}

int NGA_Active_rank()
{
return wnga_active_rank();
}

int GA_Initialized()
{
return wnga_initialized();
Expand Down
12 changes: 12 additions & 0 deletions global/src/cnames.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
#define ga_active_rank_ F77_FUNC_(ga_active_rank, GA_ACTIVE_RANK)
#define ga_cactive_rank_ F77_FUNC_(ga_cactive_rank, GA_CACTIVE_RANK)
#define ga_dactive_rank_ F77_FUNC_(ga_dactive_rank, GA_DACTIVE_RANK)
#define ga_iactive_rank_ F77_FUNC_(ga_iactive_rank, GA_IACTIVE_RANK)
#define ga_sactive_rank_ F77_FUNC_(ga_sactive_rank, GA_SACTIVE_RANK)
#define ga_zactive_rank_ F77_FUNC_(ga_zactive_rank, GA_ZACTIVE_RANK)
#define nga_active_rank_ F77_FUNC_(nga_active_rank, NGA_ACTIVE_RANK)
#define nga_cactive_rank_ F77_FUNC_(nga_cactive_rank, NGA_CACTIVE_RANK)
#define nga_dactive_rank_ F77_FUNC_(nga_dactive_rank, NGA_DACTIVE_RANK)
#define nga_iactive_rank_ F77_FUNC_(nga_iactive_rank, NGA_IACTIVE_RANK)
#define nga_sactive_rank_ F77_FUNC_(nga_sactive_rank, NGA_SACTIVE_RANK)
#define nga_zactive_rank_ F77_FUNC_(nga_zactive_rank, NGA_ZACTIVE_RANK)
#define ga_allocate_ F77_FUNC_(ga_allocate, GA_ALLOCATE)
#define ga_deallocate_ F77_FUNC_(ga_deallocate, GA_DEALLOCATE)
#define ga_callocate_ F77_FUNC_(ga_callocate,GA_CALLOCATE)
Expand Down
10 changes: 10 additions & 0 deletions global/src/fapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,16 @@ logical FATR nga_initialize_comm_(MPI_Comm comm)
return wnga_initialize_comm(comm);
}

logical FATR ga_active_rank()
{
return wnga_active_rank();
}

logical FATR nga_active_rank()
{
return wnga_active_rank();
}

void FATR ga_initialize_ltd_(Integer *limit)
{
_ga_initialize_f=1;
Expand Down
1 change: 1 addition & 0 deletions global/src/ga-papi.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ typedef intp AccessIndex;
/* Routines from base.c */
extern void pnga_version(Integer *major, Integer *minor, Integer *patch);
extern logical pnga_allocate(Integer g_a);
extern logical pnga_active_rank();
extern logical pnga_deallocate(Integer g_a);
extern logical pnga_compare_distr(Integer g_a, Integer g_b);
extern logical pnga_create(Integer type, Integer ndim,
Expand Down
2 changes: 2 additions & 0 deletions global/src/ga.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ typedef Integer ga_nbhdl_t;

extern void GA_Abs_value(int g_a);
extern void GA_Abs_value_patch(int g_a, int *lo, int *hi);
extern int GA_Active_rank();
extern void GA_Add_constant(int g_a, void* alpha);
extern void GA_Add_constant_patch(int g,int *lo,int *hi,void *alpha);
extern void GA_Add_diagonal(int g_a, int g_v);
Expand Down Expand Up @@ -199,6 +200,7 @@ extern void NGA_Access_ghost_element(int g_a, void *ptr, int subscript
extern void NGA_Access_ghosts(int g_a, int dims[], void *ptr, int ld[]);
extern void NGA_Access(int g_a, int lo[], int hi[], void *ptr, int ld[]);
extern void NGA_Acc(int g_a, int lo[], int hi[],void* buf,int ld[],void* alpha);
extern int NGA_Active_rank();
extern void NGA_Add_patch(void * alpha, int g_a, int alo[], int ahi[], void * beta, int g_b, int blo[], int bhi[], int g_c, int clo[], int chi[]);
extern int NGA_Allocate(int g_a);
extern void NGA_Alloc_gatscat_buf(int nelems);
Expand Down
2 changes: 2 additions & 0 deletions global/src/global.fh.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
!
logical ga_allocate
logical ga_deallocate
logical ga_active_rank
complex ga_cdot
complex ga_cdot_patch
integer ga_cluster_nnodes
Expand Down Expand Up @@ -76,6 +77,7 @@
double complex ga_zdot_patch
logical nga_allocate
logical nga_deallocate
logical nga_active_rank
complex nga_cdot
complex nga_cdot_patch
integer nga_cluster_nnodes
Expand Down

0 comments on commit 7a2badd

Please sign in to comment.