Skip to content

Commit

Permalink
armci portals remnants
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaypanyala committed Jul 25, 2024
1 parent 99ddb3f commit 248c042
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 178 deletions.
9 changes: 0 additions & 9 deletions armci/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@ AS_IF([test "$ARMCI_TOP_BUILDDIR" != "$ARMCI_TOP_SRCDIR"],
# MPI compiler wrappers instead of the standard compilers.
GA_MSG_COMMS

# Hack to enable NEW_MALLOC feature
AC_ARG_ENABLE([portals-new-malloc],
[AS_HELP_STRING([--enable-portals-new-malloc],
[add -DNEW_MALLOC to CPPFLAGS])])
AS_IF([test "x$enable_portals_new_malloc" = xyes],
[AC_DEFINE([NEW_MALLOC], [1], [for portals, enable new malloc])])
AM_CONDITIONAL([PORTALS_ENABLE_NEW_MALLOC],
[test "x$enable_portals_new_malloc" = xyes])

ARMCI_ENABLE_GPC
ARMCI_ENABLE_GROUP
ARMCI_ENABLE_NB_NONCONT
Expand Down
16 changes: 0 additions & 16 deletions armci/src/common/noncont.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
#if HAVE_STDIO_H
# include <stdio.h>
#endif
#ifdef PORTALS
#include "armci_portals.h"
#endif


#if 0
Expand Down Expand Up @@ -79,22 +76,9 @@ ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR
ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR,ZR};
*/

#if defined(PORTALS)
extern ARMCI_MEMHDL_T *mhloc;
extern ARMCI_MEMHDL_T *mhrem;
# define INI_HDL(_hdl, _op, _proc) { \
(_hdl).tag = GET_NEXT_NBTAG(); \
(_hdl).op = _op; \
(_hdl).proc = _proc; \
(_hdl).bufid = NB_NONE; \
}
# define CLR_HDL(_hdl) ((_hdl).tag = 0)
# define CHK_HDL(_hdl) (_hdl.tag)
#else
# define CLR_HDL(_hdl) ((_hdl) = ZR)
# define CHK_HDL(_hdl) (_hdl)
# define INI_HDL(_hdl, _op, _proc)
#endif

static int cur_get=0;
static int cur_put=0;
Expand Down
70 changes: 3 additions & 67 deletions armci/src/common/regions.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
* rdma. Coincidentally all these networks also used a server thread.
* so server_regions were allocated and enabled when REGIONS_REQUIRE_MEMHDL
* was defined.
* With Catamount, we require portals memory descriptors to be stored
* there is no server but we still need the server_regions to post match all
* md to accept all incomming requests
*/

#include "armcip.h"
Expand All @@ -35,12 +32,8 @@
#endif
#include "copy.h"

/*this should match similar def in portals.c vapi.c and openib.c */
#ifdef PORTALS
# define MAX_REGIONS 24
#else
/*this should match similar def in vapi.c and openib.c */
# define MAX_REGIONS 8
#endif

typedef struct {
void *start;
Expand Down Expand Up @@ -94,27 +87,11 @@ static int armci_region_record(void *start, void *end, armci_reglist_t *reg)

static void armci_region_register(void *start, long size, armci_reglist_t *reg)
{
#ifdef REGIONS_REQUIRE_MEMHDL
# if defined(PORTALS)
int regid = reg->n;
# endif
#endif
ARMCI_PR_DBG("enter",0);
if(reg->n >= MAX_REGIONS) return;
if(armci_nclus<=1)return;

#ifdef REGIONS_REQUIRE_MEMHDL
# if defined(PORTALS)
/*we really shouldn't have network specific ifdef's here but this is an
* exception to avoid significant code change in the portals layer
* ARMCI portals layer maintains a list of memory descriptors for each
* region allocated. It uses them in a round robin fashion. We store it
* in the memhdl to identify which memory region the memory used by a
* communication call corresponds to.
*/
(reg->list+(regid))->memhdl.regid=regid;
# endif

#ifdef REGIONS_REQUIRE_MEMHDL
if(!armci_pin_contig_hndl(start, size, &((reg->list+reg->n)->memhdl))){
printf("%d pin failed %p bytes=%ld\n",armci_me,start,size);
fflush(stdout); return;
Expand All @@ -132,54 +109,23 @@ static void armci_region_register(void *start, long size, armci_reglist_t *reg)

void armci_region_register_shm(void *start, long size)
{
#ifdef PORTALS
armci_reglist_t *reg = clus_regions+armci_clus_me;
#endif
if(allow_pin)
armci_region_register(start, size, clus_regions+armci_clus_me);
else{
needs_pin_shmptr = start;
needs_pin_shmsize= size;
}

#ifdef PORTALS
/* we mark the region as local region so that portals layer uses
* the md from memhdl instead of any region list*/
(reg->list+(reg->n-1))->memhdl.islocal=0;
#endif

#if 0
if(allow_pin){
printf("\n%d:%d registering shm %p bytes=%ld\n",armci_me,allow_pin,start,size);
fflush(stdout);
}
#endif
}


void armci_region_register_loc(void *start, long size)
{
#ifdef PORTALS
armci_reglist_t *reg = &loc_regions_arr;
#endif
if(allow_pin)armci_region_register(start, size, &loc_regions_arr);
else{
needs_pin_ptr = start;
needs_pin_size= size;
}

#ifdef PORTALS
{
extern int _armci_malloc_local_region;
if(_armci_malloc_local_region){
(reg->list+(reg->n-1))->memhdl.islocal=1;
_armci_malloc_local_region=0;
}
else
(reg->list+(reg->n-1))->memhdl.islocal=0;
}
#endif

#ifdef DEBUG_
if(allow_pin){
printf("\n%d:%d registered local %p bytes=%ld\n",armci_me,allow_pin,start,size);
Expand Down Expand Up @@ -335,14 +281,7 @@ int armci_region_both_found_hndl(void *loc, void *rem, int size, int node,
}
}

#ifdef PORTALS
if(found!=1){
*loc_memhdl=NULL;
found=1;
}
#else
if(!found) return 0;
#endif
else {*loc_memhdl=&((reg->list+i)->memhdl);}

/* now check remote shared */
Expand Down Expand Up @@ -567,10 +506,7 @@ void armci_global_region_exchange(void *start, long size)
clreglist = &(loc_regions_arr);
else
clreglist = (clus_regions+armci_clus_me);
#if defined(DATA_SERVER) || defined(PORTALS)
# if defined(PORTALS)
((reglist->list+reglist->n)->memhdl).regid=(reglist->n);
# endif
#if defined(DATA_SERVER)
armci_serv_register_req((clreglist->list+foundclus)->start,((char *)(clreglist->list+foundclus)->end-(char *)((clreglist->list+foundclus)->start)),&((reglist->list+reglist->n)->memhdl));
#endif
(void)armci_region_record((clreglist->list+foundclus)->start,(clreglist->list+foundclus)->end,reglist);
Expand Down
2 changes: 1 addition & 1 deletion armci/src/include/armcip.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ extern void armci_finalize_fence();
else FENCE_NODE(proc)
# define UPDATE_FENCE_INFO(proc_)
#elif defined(CLUSTER) && !defined(QUADRICS) && !defined(HITACHI)\
&& !defined(CRAY_SHMEM) && !defined(PORTALS)
&& !defined(CRAY_SHMEM)
# define ORDER(op_,proc_)\
if(!SAMECLUSNODE(proc_) && op_ != GET )FENCE_ARR(proc_)=1
# define UPDATE_FENCE_INFO(proc_) if(!SAMECLUSNODE(proc_))FENCE_ARR(proc_)=1
Expand Down
2 changes: 1 addition & 1 deletion armci/src/include/locks.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ extern lock_t cri_l[NUM_LOCKS];
# define NAT_LOCK(x,p) t_lock(cri_l+(x))
# define NAT_UNLOCK(x,p) t_unlock(cri_l+(x))

#elif defined(CRAY_T3E) || defined(__crayx1) || defined(CATAMOUNT) || defined(CRAY_SHMEM) || defined(PORTALS)
#elif defined(CRAY_T3E) || defined(__crayx1) || defined(CATAMOUNT) || defined(CRAY_SHMEM)
# include <limits.h>
# if defined(CRAY) || defined(CRAY_XT)
# include <mpp/shmem.h>
Expand Down
28 changes: 3 additions & 25 deletions armci/src/memory/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extern void armci_shmalloc_exchange_offsets(context_t *);
#endif

static context_t ctx_localmem;
#if defined(PORTALS_WITHREG) || defined(PORTALS) || defined(ALLOW_PIN)
#if defined(ALLOW_PIN)
static context_t ctx_mlocalmem;
#endif

Expand Down Expand Up @@ -160,9 +160,6 @@ void kr_check_local()
kr_malloc_print_stats(&ctx_localmem);
#endif
kr_malloc_verify(&ctx_localmem);
#if defined(PORTALS_WITHREG)
kr_malloc_verify(&ctx_mlocalmem);
#endif
}

void armci_print_ptr(void **ptr_arr, int bytes, int size, void* myptr, int off)
Expand Down Expand Up @@ -705,16 +702,10 @@ void armci_shmem_memctl(armci_meminfo_t *meminfo) {
#ifdef ALLOW_PIN
void *reg_malloc(size_t size)
{
#ifdef PORTALS
char *ptr;
extern void *shmalloc(size_t);
char *ptr;
ARMCI_PR_DBG("enter",0);
ptr = malloc(size);
#else
char *ptr;
ARMCI_PR_DBG("enter",0);
ptr = malloc(size);
#endif

armci_region_register_loc(ptr,size);
ARMCI_PR_DBG("exit",0);
return(ptr);
Expand Down Expand Up @@ -757,27 +748,14 @@ void armci_krmalloc_init_localmem() {
* Local Memory Allocation and Free
*/
void *PARMCI_Malloc_local(armci_size_t bytes) {
#if defined(PORTALS)
void *rptr;
#endif
ARMCI_PR_DBG("enter",0);
#if defined(PORTALS)
rptr=kr_malloc((size_t)bytes, &ctx_mlocalmem);
ARMCI_PR_DBG("exit",0);
return rptr;
#else
ARMCI_PR_DBG("exit",0);
return (void *)kr_malloc((size_t)bytes, &ctx_localmem);
#endif
}

int PARMCI_Free_local(void *ptr) {
ARMCI_PR_DBG("enter",0);
#if defined(PORTALS)
kr_free((char *)ptr, &ctx_mlocalmem);
#else
kr_free((char *)ptr, &ctx_localmem);
#endif
ARMCI_PR_DBG("exit",0);
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions armci/src/xfer/rmw.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void armci_generic_rmw(int op, void *ploc, void *prem, int extra, int proc)
switch (op) {
case ARMCI_FETCH_AND_ADD:
#if (defined(__i386__) || defined(__x86_64__)) && !defined(NO_I386ASM)
#if (defined(__GNUC__) || defined(__INTEL_COMPILER__) ||defined(__PGIC__)) && !defined(PORTALS) && !defined(NO_I386ASM)
#if (defined(__GNUC__) || defined(__INTEL_COMPILER__) ||defined(__PGIC__)) && !defined(NO_I386ASM)
if(SERVER_CONTEXT || armci_nclus == 1){
/* *(int*)ploc = __sync_fetch_and_add((int*)prem, extra); */
atomic_fetch_and_add(prem, ploc, extra, sizeof(int));
Expand All @@ -59,7 +59,7 @@ void armci_generic_rmw(int op, void *ploc, void *prem, int extra, int proc)
armci_put(&_a_ltemp,prem,sizeof(long),proc);
break;
case ARMCI_SWAP:
#if (defined(__i386__) || defined(__x86_64__)) && !defined(PORTALS) && !defined(NO_I386ASM)
#if (defined(__i386__) || defined(__x86_64__)) && !defined(NO_I386ASM)
if(SERVER_CONTEXT || armci_nclus==1){
atomic_exchange(ploc, prem, sizeof(int));
}
Expand Down
14 changes: 1 addition & 13 deletions armci/src/xfer/strided.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,18 +477,6 @@ void armci_acc_1D(int op, void *scale, int proc, void *src, void *dst, int bytes

/* if(proc!=armci_me) INTR_OFF;*/

# if defined(PORTALS)
/*even 1D armci_nbput has to use different origin counters for 1D */
# if defined(DOELAN4) && !defined(NB_NONCONT)
/*if(!ARMCI_ACC(op) && !SAMECLUSNODE(proc) && nb_handle && stride_levels<2)*/
if(!ARMCI_ACC(op) && !SAMECLUSNODE(proc) && stride_levels<2)
# else
if(!SAMECLUSNODE(proc))
# endif
armci_network_strided(op,scale,proc,src_ptr,src_stride_arr,dst_ptr,
dst_stride_arr,count,stride_levels,nb_handle);
else
# endif
switch (stride_levels) {
case 0: /* 1D copy */

Expand Down Expand Up @@ -620,7 +608,7 @@ static int _armci_puts(void *src_ptr,
PREPROCESS_STRIDED(tmp_count);
# if (!defined(QUADRICS) || defined(PACKPUT))
direct=SAMECLUSNODE(proc);
# endif /*(!QUADRICS||!PACKPUT)&&!PORTALS*/
# endif /*(!QUADRICS||!PACKPUT)*/

if(put_flag) dassert(1,nbh==NULL);

Expand Down
33 changes: 0 additions & 33 deletions armci/testing/perf_nb.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,39 +346,6 @@ void test_perf_nb(int dry_run)
ARMCI_Barrier();
}

#if PORTALS
/* See the note below why this part is disabled */
/* ---------------------- nb-Accumulate ------------------------ */
for (i = 0; i < elems[1]; i++) {
dsrc[me][i] = 1.0;
}
ARMCI_Barrier();
stride = elems[1] * sizeof(double);
scale = 1.0;
for (j = 0; j < ntimes; j++) {
stime = armci_timer();
if ((rc = ARMCI_NbAccS(ARMCI_ACC_DBL, &scale, &dsrc[me][0], &stride,
&ddst[0][0], &stride, &bytes, 0, 0, &hdl_acc))) {
ARMCI_Error("armci_nbacc failed\n", rc);
}
t8 += armci_timer() - stime;
stime = armci_timer();
ARMCI_Wait(&hdl_acc);
t9 += armci_timer() - stime;

ARMCI_Barrier();
ARMCI_AllFence();
ARMCI_Barrier();
if (VERIFY) {
verify_results(ACC, elems);
}
for (i = 0; i < elems[0]*elems[1]; i++) {
ddst[me][i] = 0.0;
}
ARMCI_Barrier();
}
#endif

/* print timings */
if (!dry_run) if (me == 0) printf("%d\t %.2e %.2e %.2e %.2e %.2e %.2e %.2e %.2e %.2e\n",
bytes, t4 / ntimes, t5 / ntimes, t6 / ntimes, t1 / ntimes,
Expand Down
11 changes: 3 additions & 8 deletions m4/ga_armci_network.m4
Original file line number Diff line number Diff line change
Expand Up @@ -491,14 +491,9 @@ AM_CONDITIONAL([CRAY_XT_NETWORKS], [test x$ga_cray_xt_networks = xyes])
ga_cv_sysv_hack=no
# Only perform this hack for ARMCI build.
AS_IF([test "x$ARMCI_TOP_BUILDDIR" != x], [
AS_IF([test x$ga_cv_sysv = xno],
[AS_CASE([$ga_armci_network],
[PORTALS|GEMINI], [ga_cv_sysv_hack=no],
[ga_cv_sysv_hack=yes])],
[ga_cv_sysv_hack=yes])
AS_IF([test x$ga_cv_sysv_hack = xyes],
[AC_DEFINE([SYSV], [1],
[Defined if we want this system to use SYSV shared memory])])
ga_cv_sysv_hack=yes
AC_DEFINE([SYSV], [1],
[Defined if we want this system to use SYSV shared memory])
])
AM_CONDITIONAL([SYSV], [test x$ga_cv_sysv_hack = xyes])
Expand Down
3 changes: 0 additions & 3 deletions m4/ga_pario.m4
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ dnl ##########################################################################
dnl FROM pario/eaf/GNUmakefile
dnl ##########################################################################
PARIO_CPPFLAGS="$PARIO_CPPFLAGS -DEAF_STATS"
if test x$ga_armci_network = xPORTALS ; then
PARIO_CPPFLAGS="$PARIO_CPPFLAGS -DCRAY_XT"
fi
dnl ##########################################################################
dnl FROM pario/dra/GNUmakefile
Expand Down

0 comments on commit 248c042

Please sign in to comment.