// oth_mpi.h
#ifndef _OTH_MPI_H_
#define _OTH_MPI_H_

#ifdef __CUDACC__
#include <cuComplex.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif

#ifdef MAIN
#define EXTERN
#else
#define EXTERN extern
#endif

EXTERN int     commSize, commRank;

// boundary
EXTERN int64_t Send0_p, Recv0_p;
EXTERN int64_t Send0_m, Recv0_m;
EXTERN int     Sendcount_p, Recvcount_p;
EXTERN int     Sendcount_m, Recvcount_m;
EXTERN double *Sendbuf_p, *Recvbuf_p;
EXTERN double *Sendbuf_m, *Recvbuf_m;
#ifndef __CUDACC__
EXTERN d_complex_t     *Sendcomplex_p, *Recvcomplex_p;
EXTERN d_complex_t     *Sendcomplex_m, *Recvcomplex_m;
#else
EXTERN cuDoubleComplex *Sendcomplex_p, *Recvcomplex_p;
EXTERN cuDoubleComplex *Sendcomplex_m, *Recvcomplex_m;
#endif

// X-PBC
EXTERN int64_t Send0_Xpbc_p, Recv0_Xpbc_p;
EXTERN int64_t Send0_Xpbc_m, Recv0_Xpbc_m;
EXTERN int     Sendcount_Xpbc_p, Recvcount_Xpbc_p;
EXTERN int     Sendcount_Xpbc_m, Recvcount_Xpbc_m;
EXTERN double *Sendbuf_Xpbc_p, *Recvbuf_Xpbc_p;
EXTERN double *Sendbuf_Xpbc_m, *Recvbuf_Xpbc_m;
#ifndef __CUDACC__
EXTERN d_complex_t     *Sendcomplex_Xpbc_p, *Recvcomplex_Xpbc_p;
EXTERN d_complex_t     *Sendcomplex_Xpbc_m, *Recvcomplex_Xpbc_m;
#else
EXTERN cuDoubleComplex *Sendcomplex_Xpbc_p, *Recvcomplex_Xpbc_p;
EXTERN cuDoubleComplex *Sendcomplex_Xpbc_m, *Recvcomplex_Xpbc_m;
#endif

#ifdef __cplusplus
}
#endif

#endif		// _OTH_MPI_H_
