Nek5000
SEM for Incompressible NS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Classes | Macros | Typedefs | Enumerations | Functions | Variables
gs.c File Reference
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "c99.h"
#include "name.h"
#include "fail.h"
#include "types.h"
#include "gs_defs.h"
#include "gs_local.h"
#include "comm.h"
#include "mem.h"
#include "sort.h"
#include "crystal.h"
#include "sarray_sort.h"
#include "sarray_transfer.h"
+ Include dependency graph for gs.c:

Go to the source code of this file.

Classes

struct  gs_topology
 
struct  nonzero_id
 
struct  unique_id
 
struct  shared_id
 
struct  primary_shared_id
 
struct  shared_id_work
 
struct  gs_remote
 
struct  pw_comm_data
 
struct  pw_data
 
struct  cr_stage
 
struct  cr_data
 
struct  crl_id
 
struct  allreduce_data
 
struct  gs_data
 

Macros

#define gs_op   gs_op_t /* fix conflict with fortran */
 
#define gs   PREFIXED_NAME(gs )
 
#define gs_vec   PREFIXED_NAME(gs_vec )
 
#define gs_many   PREFIXED_NAME(gs_many )
 
#define gs_setup   PREFIXED_NAME(gs_setup )
 
#define gs_free   PREFIXED_NAME(gs_free )
 
#define gs_unique   PREFIXED_NAME(gs_unique)
 
#define FLAGS_LOCAL   1
 
#define FLAGS_REMOTE   2
 
#define DO_COUNT(cond)
 
#define DO_SET(cond)
 
#define CW_ADD(aid, ap, ari, asi)
 
#define DRY_RUN(i, gsr, str)
 
#define DRY_RUN_CHECK(str, new_name)
 
#define cgs   PREFIXED_NAME(gs )
 
#define cgs_vec   PREFIXED_NAME(gs_vec )
 
#define cgs_many   PREFIXED_NAME(gs_many )
 
#define cgs_setup   PREFIXED_NAME(gs_setup)
 
#define cgs_free   PREFIXED_NAME(gs_free )
 
#define fgs_setup_pick   FORTRAN_NAME(gs_setup_pick,GS_SETUP_PICK)
 
#define fgs_setup   FORTRAN_NAME(gs_setup ,GS_SETUP )
 
#define fgs   FORTRAN_NAME(gs_op ,GS_OP )
 
#define fgs_vec   FORTRAN_NAME(gs_op_vec ,GS_OP_VEC )
 
#define fgs_many   FORTRAN_NAME(gs_op_many ,GS_OP_MANY )
 
#define fgs_fields   FORTRAN_NAME(gs_op_fields ,GS_OP_FIELDS )
 
#define fgs_free   FORTRAN_NAME(gs_free ,GS_FREE )
 

Typedefs

typedef void exec_fun(void *data, gs_mode mode, unsigned vn, gs_dom dom, gs_op op, unsigned transpose, const void *execdata, const struct comm *comm, char *buf)
 
typedef void fin_fun(void *data)
 
typedef void setup_fun(struct gs_remote *r, struct gs_topology *top, const struct comm *comm, buffer *buf)
 

Enumerations

enum  gs_mode { mode_plain, mode_vec, mode_many, mode_dry_run }
 
enum  gs_method {
  gs_auto, gs_pairwise, gs_crystal_router, gs_all_reduce,
  gs_auto, gs_pairwise, gs_crystal_router, gs_all_reduce
}
 

Functions

static void gather_noop (void *out, const void *in, const unsigned vn, const uint *map, gs_dom dom, gs_op op)
 
static void scatter_noop (void *out, const void *in, const unsigned vn, const uint *map, gs_dom dom)
 
static void init_noop (void *out, const unsigned vn, const uint *map, gs_dom dom, gs_op op)
 
static void gs_topology_free (struct gs_topology *top)
 
static void nonzero_ids (struct array *nz, const slong *id, const uint n, buffer *buf)
 
static void unique_ids (struct array *un, const struct array *nz, const uint np)
 
static void shared_ids_aux (struct array *sh, struct array *pr, uint pr_n, struct array *wa, buffer *buf)
 
static ulong shared_ids (struct array *sh, struct array *pr, const struct array *nz, struct crystal *cr)
 
static void get_topology (struct gs_topology *top, const slong *id, uint n, struct crystal *cr)
 
static void make_topology_unique (struct gs_topology *top, slong *id, uint pid, buffer *buf)
 
static const uintlocal_map (const struct array *nz, const int ignore_flagged, uint *mem_size)
 
static const uintflagged_primaries_map (const struct array *nz, uint *mem_size)
 
static char * pw_exec_recvs (char *buf, const unsigned unit_size, const struct comm *comm, const struct pw_comm_data *c, comm_req *req)
 
static char * pw_exec_sends (char *buf, const unsigned unit_size, const struct comm *comm, const struct pw_comm_data *c, comm_req *req)
 
static void pw_exec (void *data, gs_mode mode, unsigned vn, gs_dom dom, gs_op op, unsigned transpose, const void *execdata, const struct comm *comm, char *buf)
 
static uint pw_comm_setup (struct pw_comm_data *data, struct array *sh, const unsigned flags_mask, buffer *buf)
 
static void pw_comm_free (struct pw_comm_data *data)
 
static const uintpw_map_setup (struct array *sh, buffer *buf, uint *mem_size)
 
static struct pw_datapw_setup_aux (struct array *sh, buffer *buf, uint *mem_size)
 
static void pw_free (struct pw_data *data)
 
static void pw_setup (struct gs_remote *r, struct gs_topology *top, const struct comm *comm, buffer *buf)
 
static void cr_exec (void *data, gs_mode mode, unsigned vn, gs_dom dom, gs_op op, unsigned transpose, const void *execdata, const struct comm *comm, char *buf)
 
static uint cr_schedule (struct cr_data *data, const struct comm *comm)
 
static void crl_work_init (struct array *cw, struct array *sh, const unsigned send_mask, uint this_p)
 
static uint crl_maps (struct cr_stage *stage, struct array *cw, buffer *buf)
 
static uint crl_work_label (struct array *cw, struct cr_stage *stage, uint cutoff, int send_hi, buffer *buf, uint *mem_size)
 
static void crl_bi_to_si (struct crl_id *w, uint n, uint v)
 
static void crl_ri_to_bi (struct crl_id *w, uint n)
 
static uint cr_learn (struct array *cw, struct cr_stage *stage, const struct comm *comm, buffer *buf, uint *mem_size)
 
static struct cr_datacr_setup_aux (struct array *sh, const struct comm *comm, buffer *buf, uint *mem_size)
 
static void cr_free_stage_maps (struct cr_stage *stage, unsigned kmax)
 
static void cr_free (struct cr_data *data)
 
static void cr_setup (struct gs_remote *r, struct gs_topology *top, const struct comm *comm, buffer *buf)
 
static void allreduce_exec (void *data, gs_mode mode, unsigned vn, gs_dom dom, gs_op op, unsigned transpose, const void *execdata, const struct comm *comm, char *buf)
 
static const uintallreduce_map_setup (struct array *pr, const unsigned flags_mask, int to_buf, uint *mem_size)
 
static struct allreduce_dataallreduce_setup_aux (struct array *pr, ulong total_shared, uint *mem_size)
 
static void allreduce_free (struct allreduce_data *ard)
 
static void allreduce_setup (struct gs_remote *r, struct gs_topology *top, const struct comm *comm, buffer *buf)
 
static void dry_run_time (double times[3], const struct gs_remote *r, const struct comm *comm, buffer *buf)
 
static void auto_setup (struct gs_remote *r, struct gs_topology *top, const struct comm *comm, buffer *buf)
 
static void gs_aux (void *u, gs_mode mode, unsigned vn, gs_dom dom, gs_op op, unsigned transpose, struct gs_data *gsh, buffer *buf)
 
void gs (void *u, gs_dom dom, gs_op op, unsigned transpose, struct gs_data *gsh, buffer *buf)
 
void gs_vec (void *u, unsigned vn, gs_dom dom, gs_op op, unsigned transpose, struct gs_data *gsh, buffer *buf)
 
void gs_many (void *const *u, unsigned vn, gs_dom dom, gs_op op, unsigned transpose, struct gs_data *gsh, buffer *buf)
 
static uint local_setup (struct gs_data *gsh, const struct array *nz)
 
static void gs_setup_aux (struct gs_data *gsh, const slong *id, uint n, int unique, gs_method method, int verbose)
 
struct gs_datags_setup (const slong *id, uint n, const struct comm *comm, int unique, gs_method method, int verbose)
 
void gs_free (struct gs_data *gsh)
 
void gs_unique (slong *id, uint n, const struct comm *comm)
 
void fgs_setup_pick (sint *handle, const slong id[], const sint *n, const MPI_Fint *comm, const sint *np, const sint *method)
 
void fgs_setup (sint *handle, const slong id[], const sint *n, const MPI_Fint *comm, const sint *np)
 
static void fgs_check_handle (sint handle, const char *func, unsigned line)
 
static void fgs_check_parms (sint handle, sint dom, sint op, const char *func, unsigned line)
 
void fgs (const sint *handle, void *u, const sint *dom, const sint *op, const sint *transpose)
 
void fgs_vec (const sint *handle, void *u, const sint *n, const sint *dom, const sint *op, const sint *transpose)
 
void fgs_many (const sint *handle, void *u1, void *u2, void *u3, void *u4, void *u5, void *u6, const sint *n, const sint *dom, const sint *op, const sint *transpose)
 
void fgs_fields (const sint *handle, void *u, const sint *stride, const sint *n, const sint *dom, const sint *op, const sint *transpose)
 
void fgs_free (const sint *handle)
 

Variables

static buffer static_buffer = null_buffer
 
static struct gs_data ** fgs_info = 0
 
static int fgs_max = 0
 
static int fgs_n = 0
 
static const gs_dom fgs_dom [4] = { 0, gs_double, gs_sint, gs_slong }
 
static struct array fgs_fields_array = null_array
 

Macro Definition Documentation

#define cgs   PREFIXED_NAME(gs )

Definition at line 1180 of file gs.c.

Referenced by fgs().

#define cgs_free   PREFIXED_NAME(gs_free )

Definition at line 1184 of file gs.c.

Referenced by fgs_free().

#define cgs_many   PREFIXED_NAME(gs_many )

Definition at line 1182 of file gs.c.

Referenced by fgs_fields(), and fgs_many().

#define cgs_setup   PREFIXED_NAME(gs_setup)

Definition at line 1183 of file gs.c.

#define cgs_vec   PREFIXED_NAME(gs_vec )

Definition at line 1181 of file gs.c.

Referenced by fgs_vec().

#define CW_ADD (   aid,
  ap,
  ari,
  asi 
)
Value:
do { \
if(cw_n==cw_max) \
array_reserve(struct crl_id,cw,cw_n+1),cw_max=cw->max, \
w=(struct crl_id*)cw->ptr+cw_n; \
w->id=aid, w->p=ap, w->ri=ari, w->si=asi; \
++w, ++cw_n; \
} while(0)
#define array_reserve(T, a, min)
Definition: mem.h:138
Definition: gs.c:661

Referenced by crl_work_init().

#define DO_COUNT (   cond)
Value:
do \
for(row=nz->ptr,end=row+nz->n;row!=end;) { \
ulong row_id = row->id; int any=0; \
for(other=row+1;other!=end&&other->id==row_id&&cond;++other) \
any=2, ++count; \
count+=any, row=other; \
} while(0)
#define ulong
Definition: types.h:75
const uint nz[3]
Definition: xxt_test.c:78

Referenced by local_map().

#define DO_SET (   cond)
Value:
do \
for(row=nz->ptr,end=row+nz->n;row!=end;) { \
ulong row_id = row->id; int any=0; \
*p++ = row->i; \
for(other=row+1;other!=end&&other->id==row_id&&cond;++other) \
any=1, *p++ = other->i; \
if(any) *p++ = -(uint)1; else --p; \
row=other; \
} while(0)
#define uint
Definition: types.h:70
p
Definition: xxt_test2.m:1
#define ulong
Definition: types.h:75
const uint nz[3]
Definition: xxt_test.c:78

Referenced by local_map().

#define DRY_RUN (   i,
  gsr,
  str 
)
Value:
do { \
if(comm->id==0) printf(" " str ": "); \
dry_run_time(time[i],gsr,comm,buf); \
if(comm->id==0) \
printf("%g %g %g\n",time[i][0],time[i][1],time[i][2]); \
} while(0)
n
Definition: xxt_test.m:73
Definition: comm.h:85
static void dry_run_time(double times[3], const struct gs_remote *r, const struct comm *comm, buffer *buf)
Definition: gs.c:975
for i
Definition: xxt_test.m:74
uint id
Definition: comm.h:86

Referenced by auto_setup().

#define DRY_RUN_CHECK (   str,
  new_name 
)
Value:
do { \
DRY_RUN(1,&r_alt,str); \
if(time[1][2]<time[0][2]) \
time[0][2]=time[1][2], name=new_name, \
r->fin(r->data), *r = r_alt; \
else \
r_alt.fin(r_alt.data); \
} while(0)
#define DRY_RUN(i, gsr, str)
static char name[MAX_NAME+1]
Definition: byte.c:53

Referenced by auto_setup().

#define fgs   FORTRAN_NAME(gs_op ,GS_OP )

Definition at line 1188 of file gs.c.

#define fgs_fields   FORTRAN_NAME(gs_op_fields ,GS_OP_FIELDS )

Definition at line 1191 of file gs.c.

#define fgs_free   FORTRAN_NAME(gs_free ,GS_FREE )

Definition at line 1192 of file gs.c.

#define fgs_many   FORTRAN_NAME(gs_op_many ,GS_OP_MANY )

Definition at line 1190 of file gs.c.

#define fgs_setup   FORTRAN_NAME(gs_setup ,GS_SETUP )

Definition at line 1187 of file gs.c.

#define fgs_setup_pick   FORTRAN_NAME(gs_setup_pick,GS_SETUP_PICK)

Definition at line 1186 of file gs.c.

Referenced by fgs_setup().

#define fgs_vec   FORTRAN_NAME(gs_op_vec ,GS_OP_VEC )

Definition at line 1189 of file gs.c.

#define FLAGS_LOCAL   1

Definition at line 148 of file gs.c.

Referenced by cr_setup_aux(), crl_work_init(), make_topology_unique(), pw_setup_aux(), and shared_ids_aux().

#define FLAGS_REMOTE   2

Definition at line 149 of file gs.c.

Referenced by cr_setup_aux(), crl_work_init(), make_topology_unique(), pw_setup_aux(), and shared_ids_aux().

#define gs   PREFIXED_NAME(gs )

Definition at line 26 of file gs.c.

Referenced by discover_dofs(), and test().

#define gs_free   PREFIXED_NAME(gs_free )

Definition at line 30 of file gs.c.

Referenced by discover_dofs(), set_up_h1_crs(), and test().

#define gs_many   PREFIXED_NAME(gs_many )

Definition at line 28 of file gs.c.

#define gs_op   gs_op_t /* fix conflict with fortran */
#define gs_setup   PREFIXED_NAME(gs_setup )

Definition at line 29 of file gs.c.

Referenced by discover_dofs(), set_up_h1_crs(), setupds(), and test().

#define gs_unique   PREFIXED_NAME(gs_unique)

Definition at line 31 of file gs.c.

Referenced by test().

#define gs_vec   PREFIXED_NAME(gs_vec )

Definition at line 27 of file gs.c.

Typedef Documentation

typedef void exec_fun(void *data, gs_mode mode, unsigned vn, gs_dom dom, gs_op op, unsigned transpose, const void *execdata, const struct comm *comm, char *buf)

Definition at line 379 of file gs.c.

typedef void fin_fun(void *data)

Definition at line 382 of file gs.c.

typedef void setup_fun(struct gs_remote *r, struct gs_topology *top, const struct comm *comm, buffer *buf)

Definition at line 391 of file gs.c.

Enumeration Type Documentation

enum gs_method
Enumerator
gs_auto 
gs_pairwise 
gs_crystal_router 
gs_all_reduce 
gs_auto 
gs_pairwise 
gs_crystal_router 
gs_all_reduce 

Definition at line 1086 of file gs.c.

enum gs_mode
Enumerator
mode_plain 
mode_vec 
mode_many 
mode_dry_run 

Definition at line 35 of file gs.c.

Function Documentation

static void allreduce_exec ( void *  data,
gs_mode  mode,
unsigned  vn,
gs_dom  dom,
gs_op  op,
unsigned  transpose,
const void *  execdata,
const struct comm comm,
char *  buf 
)
static

Definition at line 887 of file gs.c.

References allreduce_data::buffer_size, comm_allreduce(), dom, gs_init_array, gs_scatter, gs_scatter_many_to_vec, gs_scatter_vec, gs_scatter_vec_to_many, allreduce_data::map_from_buf, allreduce_data::map_to_buf, scatter_noop(), transpose(), and uint.

Referenced by allreduce_setup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void allreduce_free ( struct allreduce_data ard)
static

Definition at line 951 of file gs.c.

References allreduce_data::map_from_buf, allreduce_data::map_to_buf, and uint.

Referenced by allreduce_setup().

+ Here is the caller graph for this function:

static const uint* allreduce_map_setup ( struct array pr,
const unsigned  flags_mask,
int  to_buf,
uint mem_size 
)
static

Definition at line 912 of file gs.c.

References primary_shared_id::flag, primary_shared_id::i, array::n, primary_shared_id::ord, p, array::ptr, tmalloc, and uint.

Referenced by allreduce_setup_aux().

+ Here is the caller graph for this function:

static void allreduce_setup ( struct gs_remote r,
struct gs_topology top,
const struct comm comm,
buffer buf 
)
static

Definition at line 960 of file gs.c.

References allreduce_exec(), allreduce_free(), allreduce_setup_aux(), gs_remote::buffer_size, allreduce_data::buffer_size, gs_remote::data, gs_remote::exec, gs_remote::fin, gs_remote::mem_size, gs_topology::pr, and gs_topology::total_shared.

Referenced by auto_setup(), and gs_setup_aux().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static struct allreduce_data* allreduce_setup_aux ( struct array pr,
ulong  total_shared,
uint mem_size 
)
static

Definition at line 933 of file gs.c.

References allreduce_map_setup(), allreduce_data::buffer_size, allreduce_data::map_from_buf, allreduce_data::map_to_buf, and tmalloc.

Referenced by allreduce_setup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void auto_setup ( struct gs_remote r,
struct gs_topology top,
const struct comm comm,
buffer buf 
)
static

Definition at line 993 of file gs.c.

References allreduce_setup(), cr_setup(), DRY_RUN, DRY_RUN_CHECK, comm::id, name, comm::np, pw_setup(), and gs_topology::total_shared.

Referenced by gs_setup_aux().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void cr_exec ( void *  data,
gs_mode  mode,
unsigned  vn,
gs_dom  dom,
gs_op  op,
unsigned  transpose,
const void *  execdata,
const struct comm comm,
char *  buf 
)
static

Definition at line 581 of file gs.c.

References comm_irecv(), comm_isend(), comm_wait(), dom, cr_stage::gather_map, gather_noop(), gs_gather, gs_gather_vec, gs_gather_vec_to_many, gs_scatter, gs_scatter_many_to_vec, gs_scatter_vec, gs_scatter_vec_to_many, comm::np, cr_stage::nrecvn, cr_data::nstages, cr_stage::p1, cr_stage::p2, cr_stage::scatter_map, scatter_noop(), cr_stage::size_r, cr_stage::size_r1, cr_stage::size_r2, cr_stage::size_s, cr_data::stage, cr_data::stage_buffer_size, and transpose().

Referenced by cr_setup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void cr_free ( struct cr_data data)
static

Definition at line 861 of file gs.c.

References cr_free_stage_maps(), cr_data::nstages, and cr_data::stage.

Referenced by cr_setup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void cr_free_stage_maps ( struct cr_stage stage,
unsigned  kmax 
)
static

Definition at line 851 of file gs.c.

References cr_stage::scatter_map, cr_data::stage, and uint.

Referenced by cr_free().

+ Here is the caller graph for this function:

static uint cr_learn ( struct array cw,
struct cr_stage stage,
const struct comm comm,
buffer buf,
uint mem_size 
)
static

Definition at line 768 of file gs.c.

References array_reserve, crl_id::bi, comm_irecv(), comm_isend(), comm_wait(), crl_bi_to_si(), crl_maps(), crl_ri_to_bi(), crl_work_label(), comm::id, n, array::n, comm::np, cr_stage::nrecvn, cr_stage::p1, cr_stage::p2, array::ptr, sarray_sort_2, crl_id::send, cr_stage::size_r, cr_stage::size_r1, cr_stage::size_r2, cr_stage::size_s, cr_stage::size_sk, cr_stage::size_total, and uint.

Referenced by cr_setup_aux().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uint cr_schedule ( struct cr_data data,
const struct comm comm 
)
static

Definition at line 630 of file gs.c.

References comm::id, n, comm::np, cr_stage::nrecvn, cr_data::nstages, cr_stage::p1, cr_stage::p2, cr_data::stage, tmalloc, and uint.

Referenced by cr_setup_aux().

+ Here is the caller graph for this function:

static void cr_setup ( struct gs_remote r,
struct gs_topology top,
const struct comm comm,
buffer buf 
)
static

Definition at line 869 of file gs.c.

References gs_remote::buffer_size, cr_data::buffer_size, cr_exec(), cr_free(), cr_setup_aux(), gs_remote::data, gs_remote::exec, gs_remote::fin, gs_remote::mem_size, and gs_topology::sh.

Referenced by auto_setup(), and gs_setup_aux().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static struct cr_data* cr_setup_aux ( struct array sh,
const struct comm comm,
buffer buf,
uint mem_size 
)
static

Definition at line 824 of file gs.c.

References array_free, cr_data::buffer_size, cr_learn(), cr_schedule(), crl_work_init(), FLAGS_LOCAL, FLAGS_REMOTE, i, comm::id, array::n, null_array, array::ptr, sarray_sort, cr_data::stage, cr_data::stage_buffer_size, tmalloc, and uint.

Referenced by cr_setup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void crl_bi_to_si ( struct crl_id w,
uint  n,
uint  v 
)
static

Definition at line 760 of file gs.c.

References crl_id::bi, n, and crl_id::si.

Referenced by cr_learn().

+ Here is the caller graph for this function:

static uint crl_maps ( struct cr_stage stage,
struct array cw,
buffer buf 
)
static

Definition at line 697 of file gs.c.

References crl_id::bi, cr_stage::gather_map, array::n, array::ptr, sarray_sort_2, cr_stage::scatter_map, crl_id::si, tmalloc, and uint.

Referenced by cr_learn(), and crl_work_label().

+ Here is the caller graph for this function:

static void crl_ri_to_bi ( struct crl_id w,
uint  n 
)
static

Definition at line 764 of file gs.c.

References crl_id::bi, n, and crl_id::ri.

Referenced by cr_learn().

+ Here is the caller graph for this function:

static void crl_work_init ( struct array cw,
struct array sh,
const unsigned  send_mask,
uint  this_p 
)
static

Definition at line 666 of file gs.c.

References CW_ADD, shared_id::flags, FLAGS_LOCAL, FLAGS_REMOTE, shared_id::i, shared_id::id, array::max, array::n, shared_id::p, array::ptr, shared_id::ri, se, and uint.

Referenced by cr_setup_aux().

+ Here is the caller graph for this function:

static uint crl_work_label ( struct array cw,
struct cr_stage stage,
uint  cutoff,
int  send_hi,
buffer buf,
uint mem_size 
)
static

Definition at line 726 of file gs.c.

References crl_id::bi, crl_maps(), crl_id::id, array::n, crl_id::p, array::ptr, sarray_sort, sarray_sort_2, crl_id::send, cr_stage::size_s, cr_stage::size_sk, and uint.

Referenced by cr_learn().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void dry_run_time ( double  times[3],
const struct gs_remote r,
const struct comm comm,
buffer buf 
)
static

Definition at line 975 of file gs.c.

References buffer_reserve, gs_remote::buffer_size, comm_allreduce(), comm_barrier(), comm_time(), gs_remote::data, gs_remote::exec, i, mode_dry_run, comm::np, and array::ptr.

+ Here is the call graph for this function:

void fgs ( const sint handle,
void *  u,
const sint dom,
const sint op,
const sint transpose 
)

Definition at line 1235 of file gs.c.

References cgs, fgs_check_parms(), and fgs_dom.

+ Here is the call graph for this function:

static void fgs_check_handle ( sint  handle,
const char *  func,
unsigned  line 
)
static

Definition at line 1217 of file gs.c.

References fail(), and fgs_n.

Referenced by fgs_check_parms(), and fgs_free().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void fgs_check_parms ( sint  handle,
sint  dom,
sint  op,
const char *  func,
unsigned  line 
)
static

Definition at line 1225 of file gs.c.

References fail(), and fgs_check_handle().

Referenced by fgs(), fgs_fields(), fgs_many(), and fgs_vec().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fgs_fields ( const sint handle,
void *  u,
const sint stride,
const sint n,
const sint dom,
const sint op,
const sint transpose 
)

Definition at line 1263 of file gs.c.

References array_reserve, cgs_many, fgs_check_parms(), fgs_dom, i, p, array::ptr, and uint.

+ Here is the call graph for this function:

void fgs_free ( const sint handle)

Definition at line 1284 of file gs.c.

References cgs_free, and fgs_check_handle().

+ Here is the call graph for this function:

void fgs_many ( const sint handle,
void *  u1,
void *  u2,
void *  u3,
void *  u4,
void *  u5,
void *  u6,
const sint n,
const sint dom,
const sint op,
const sint transpose 
)

Definition at line 1250 of file gs.c.

References cgs_many, fgs_check_parms(), and fgs_dom.

+ Here is the call graph for this function:

void fgs_setup ( sint handle,
const slong  id[],
const sint n,
const MPI_Fint comm,
const sint np 
)

Definition at line 1210 of file gs.c.

References fgs_setup_pick, gs_auto, and sint.

void fgs_setup_pick ( sint handle,
const slong  id[],
const sint n,
const MPI_Fint comm,
const sint np,
const sint method 
)

Definition at line 1198 of file gs.c.

References gs_data::comm, comm_init_check, fgs_max, fgs_n, gs_setup_aux(), tmalloc, and trealloc.

+ Here is the call graph for this function:

void fgs_vec ( const sint handle,
void *  u,
const sint n,
const sint dom,
const sint op,
const sint transpose 
)

Definition at line 1242 of file gs.c.

References cgs_vec, fgs_check_parms(), and fgs_dom.

+ Here is the call graph for this function:

static const uint* flagged_primaries_map ( const struct array nz,
uint mem_size 
)
static

Definition at line 362 of file gs.c.

References nonzero_id::flag, nonzero_id::i, array::n, p, nonzero_id::primary, array::ptr, tmalloc, and uint.

Referenced by local_setup().

+ Here is the caller graph for this function:

static void gather_noop ( void *  out,
const void *  in,
const unsigned  vn,
const uint map,
gs_dom  dom,
gs_op  op 
)
static

Definition at line 40 of file gs.c.

Referenced by cr_exec(), gs_aux(), and pw_exec().

+ Here is the caller graph for this function:

static void get_topology ( struct gs_topology top,
const slong id,
uint  n,
struct crystal cr 
)
static

Definition at line 249 of file gs.c.

References crystal::data, nonzero_ids(), gs_topology::nz, gs_topology::pr, gs_topology::sh, shared_ids(), and gs_topology::total_shared.

Referenced by gs_setup_aux(), and gs_unique().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void gs ( void *  u,
gs_dom  dom,
gs_op  op,
unsigned  transpose,
struct gs_data gsh,
buffer buf 
)

Definition at line 1065 of file gs.c.

References gs_aux(), and mode_plain.

+ Here is the call graph for this function:

static void gs_aux ( void *  u,
gs_mode  mode,
unsigned  vn,
gs_dom  dom,
gs_op  op,
unsigned  transpose,
struct gs_data gsh,
buffer buf 
)
static

Definition at line 1047 of file gs.c.

References buffer_reserve, gs_remote::buffer_size, gs_data::comm, gs_remote::data, dom, gs_remote::exec, gs_data::flagged_primaries, gather_noop(), gs_gather, gs_gather_many, gs_gather_vec, gs_init, gs_init_many, gs_init_vec, gs_scatter, gs_scatter_many, gs_scatter_vec, init_noop(), gs_data::map_local, array::ptr, gs_data::r, scatter_noop(), static_buffer, and transpose().

Referenced by gs(), gs_many(), and gs_vec().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void gs_free ( struct gs_data gsh)

Definition at line 1149 of file gs.c.

References gs_data::comm, comm_free(), gs_remote::data, gs_remote::fin, gs_data::flagged_primaries, gs_data::map_local, gs_data::r, and uint.

+ Here is the call graph for this function:

void gs_many ( void *const *  u,
unsigned  vn,
gs_dom  dom,
gs_op  op,
unsigned  transpose,
struct gs_data gsh,
buffer buf 
)

Definition at line 1077 of file gs.c.

References gs_aux(), and mode_many.

+ Here is the call graph for this function:

struct gs_data* gs_setup ( const slong id,
uint  n,
const struct comm comm,
int  unique,
gs_method  method,
int  verbose 
)

Definition at line 1140 of file gs.c.

References gs_data::comm, comm_dup, gs_setup_aux(), and tmalloc.

+ Here is the call graph for this function:

static void gs_setup_aux ( struct gs_data gsh,
const slong id,
uint  n,
int  unique,
gs_method  method,
int  verbose 
)
static

Definition at line 1097 of file gs.c.

References allreduce_setup(), auto_setup(), gs_remote::buffer_size, gs_data::comm, comm_allreduce(), cr_setup(), crystal_free, crystal_init, crystal::data, get_topology(), gs_sint, gs_topology_free(), gs_data::handle_size, comm::id, local_setup(), make_topology_unique(), gs_remote::mem_size, comm::np, gs_topology::nz, pw_setup(), gs_data::r, gs_topology::total_shared, and uint.

Referenced by fgs_setup_pick(), and gs_setup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void gs_topology_free ( struct gs_topology top)
static

Definition at line 67 of file gs.c.

References array_free, gs_topology::nz, gs_topology::pr, and gs_topology::sh.

Referenced by gs_setup_aux(), and gs_unique().

+ Here is the caller graph for this function:

void gs_unique ( slong id,
uint  n,
const struct comm comm 
)

Definition at line 1158 of file gs.c.

References crystal_free, crystal_init, crystal::data, get_topology(), gs_topology_free(), comm::id, and make_topology_unique().

+ Here is the call graph for this function:

void gs_vec ( void *  u,
unsigned  vn,
gs_dom  dom,
gs_op  op,
unsigned  transpose,
struct gs_data gsh,
buffer buf 
)

Definition at line 1071 of file gs.c.

References gs_aux(), and mode_vec.

+ Here is the call graph for this function:

static void init_noop ( void *  out,
const unsigned  vn,
const uint map,
gs_dom  dom,
gs_op  op 
)
static

Definition at line 50 of file gs.c.

Referenced by gs_aux().

+ Here is the caller graph for this function:

static const uint* local_map ( const struct array nz,
const int  ignore_flagged,
uint mem_size 
)
static

Definition at line 332 of file gs.c.

References DO_COUNT, DO_SET, nonzero_id::flag, p, tmalloc, and uint.

Referenced by local_setup().

+ Here is the caller graph for this function:

static uint local_setup ( struct gs_data gsh,
const struct array nz 
)
static

Definition at line 1088 of file gs.c.

References gs_data::flagged_primaries, flagged_primaries_map(), local_map(), gs_data::map_local, gs_remote::mem_size, and uint.

Referenced by gs_setup_aux().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void make_topology_unique ( struct gs_topology top,
slong id,
uint  pid,
buffer buf 
)
static

Definition at line 256 of file gs.c.

References array_reserve, nonzero_id::flag, primary_shared_id::flag, shared_id::flags, FLAGS_LOCAL, FLAGS_REMOTE, i, nonzero_id::i, shared_id::i, nonzero_id::id, shared_id::id, primary_shared_id::id, array::n, gs_topology::nz, nz, out, p, shared_id::p, gs_topology::pr, nonzero_id::primary, array::ptr, sarray_sort, sarray_sort_2, gs_topology::sh, slong, and uint.

Referenced by gs_setup_aux(), and gs_unique().

+ Here is the caller graph for this function:

static void nonzero_ids ( struct array nz,
const slong id,
const uint  n,
buffer buf 
)
static

Definition at line 90 of file gs.c.

References array_init, array_resize, flag, nonzero_id::flag, i, nonzero_id::i, iabsl, nonzero_id::id, n, array::n, nonzero_id::primary, array::ptr, sarray_sort, sarray_sort_2, slong, uint, and ulong.

Referenced by get_topology().

+ Here is the caller graph for this function:

static void pw_comm_free ( struct pw_comm_data data)
static

Definition at line 495 of file gs.c.

References pw_comm_data::p.

Referenced by pw_free().

+ Here is the caller graph for this function:

static uint pw_comm_setup ( struct pw_comm_data data,
struct array sh,
const unsigned  flags_mask,
buffer buf 
)
static

Definition at line 464 of file gs.c.

References shared_id::bi, shared_id::flags, n, array::n, pw_comm_data::n, p, shared_id::p, pw_comm_data::p, array::ptr, sarray_sort_2, se, pw_comm_data::size, tmalloc, pw_comm_data::total, and uint.

Referenced by pw_setup_aux().

+ Here is the caller graph for this function:

static void pw_exec ( void *  data,
gs_mode  mode,
unsigned  vn,
gs_dom  dom,
gs_op  op,
unsigned  transpose,
const void *  execdata,
const struct comm comm,
char *  buf 
)
static

Definition at line 437 of file gs.c.

References pw_data::comm, comm_wait(), dom, gather_noop(), gs_gather, gs_gather_vec, gs_gather_vec_to_many, gs_scatter, gs_scatter_many_to_vec, gs_scatter_vec, pw_data::map, pw_comm_data::n, pw_exec_recvs(), pw_exec_sends(), pw_data::req, scatter_noop(), and transpose().

Referenced by pw_setup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char* pw_exec_recvs ( char *  buf,
const unsigned  unit_size,
const struct comm comm,
const struct pw_comm_data c,
comm_req req 
)
static

Definition at line 411 of file gs.c.

References comm_irecv(), pw_comm_data::n, p, pw_comm_data::p, pw_comm_data::size, and uint.

Referenced by pw_exec().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char* pw_exec_sends ( char *  buf,
const unsigned  unit_size,
const struct comm comm,
const struct pw_comm_data c,
comm_req req 
)
static

Definition at line 424 of file gs.c.

References comm_isend(), comm::id, pw_comm_data::n, p, pw_comm_data::p, pw_comm_data::size, and uint.

Referenced by pw_exec().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void pw_free ( struct pw_data data)
static

Definition at line 544 of file gs.c.

References pw_data::comm, pw_data::map, pw_comm_free(), pw_data::req, and uint.

Referenced by pw_setup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static const uint* pw_map_setup ( struct array sh,
buffer buf,
uint mem_size 
)
static

Definition at line 498 of file gs.c.

References shared_id::bi, i, shared_id::i, array::n, p, array::ptr, sarray_sort, se, tmalloc, and uint.

Referenced by pw_setup_aux().

+ Here is the caller graph for this function:

static void pw_setup ( struct gs_remote r,
struct gs_topology top,
const struct comm comm,
buffer buf 
)
static

Definition at line 554 of file gs.c.

References gs_remote::buffer_size, pw_data::buffer_size, gs_remote::data, gs_remote::exec, gs_remote::fin, gs_remote::mem_size, pw_exec(), pw_free(), pw_setup_aux(), and gs_topology::sh.

Referenced by auto_setup(), and gs_setup_aux().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static struct pw_data* pw_setup_aux ( struct array sh,
buffer buf,
uint mem_size 
)
static

Definition at line 524 of file gs.c.

References pw_data::buffer_size, pw_data::comm, FLAGS_LOCAL, FLAGS_REMOTE, pw_data::map, pw_comm_data::n, pw_comm_setup(), pw_map_setup(), pw_data::req, tmalloc, and pw_comm_data::total.

Referenced by pw_setup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void scatter_noop ( void *  out,
const void *  in,
const unsigned  vn,
const uint map,
gs_dom  dom 
)
static

Definition at line 45 of file gs.c.

Referenced by allreduce_exec(), cr_exec(), gs_aux(), and pw_exec().

+ Here is the caller graph for this function:

static ulong shared_ids ( struct array sh,
struct array pr,
const struct array nz,
struct crystal cr 
)
static

Definition at line 193 of file gs.c.

References array_free, array_init, array_reserve, crystal::comm, comm_scan(), crystal::data, gs_slong, shared_id_work::i1f, shared_id_work::i2f, id, unique_id::id, shared_id_work::id, array::max, array::n, comm::np, shared_id_work::ord, shared_id_work::p1, shared_id_work::p2, array::ptr, sarray_sort_2, sarray_transfer, shared_ids_aux(), unique_id::src_if, uint, ulong, unique_ids(), and unique_id::work_proc.

Referenced by get_topology().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void shared_ids_aux ( struct array sh,
struct array pr,
uint  pr_n,
struct array wa,
buffer buf 
)
static

Definition at line 166 of file gs.c.

References array_init, primary_shared_id::flag, shared_id::flags, FLAGS_LOCAL, FLAGS_REMOTE, i, shared_id::i, primary_shared_id::i, shared_id_work::i1f, shared_id_work::i2f, shared_id::id, primary_shared_id::id, shared_id_work::id, array::n, primary_shared_id::ord, shared_id_work::ord, p, shared_id::p, shared_id_work::p2, array::ptr, shared_id::ri, sarray_sort, uint, and ulong.

Referenced by shared_ids().

+ Here is the caller graph for this function:

static void unique_ids ( struct array un,
const struct array nz,
const uint  np 
)
static

Definition at line 121 of file gs.c.

References array_init, nonzero_id::flag, nonzero_id::i, nonzero_id::id, unique_id::id, array::n, np, nonzero_id::primary, array::ptr, unique_id::src_if, and unique_id::work_proc.

Referenced by shared_ids().

+ Here is the caller graph for this function:

Variable Documentation

const gs_dom fgs_dom[4] = { 0, gs_double, gs_sint, gs_slong }
static

Definition at line 1223 of file gs.c.

Referenced by fgs(), fgs_fields(), fgs_many(), and fgs_vec().

struct array fgs_fields_array = null_array
static

Definition at line 1261 of file gs.c.

struct gs_data** fgs_info = 0
static

Definition at line 1194 of file gs.c.

int fgs_max = 0
static

Definition at line 1195 of file gs.c.

Referenced by fgs_setup_pick().

int fgs_n = 0
static

Definition at line 1196 of file gs.c.

Referenced by fgs_check_handle(), and fgs_setup_pick().

buffer static_buffer = null_buffer
static

Definition at line 38 of file gs.c.

Referenced by gs_aux().