Program Listing for File t8_shmem.h
↰ Return to documentation for file (src/t8_data/t8_shmem.h)
/*
This file is part of t8code.
t8code is a C library to manage a collection (a forest) of multiple
connected adaptive space-trees of general element classes in parallel.
Copyright (C) 2015 the developers
t8code is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
t8code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with t8code; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef T8_SHMEM_H
#define T8_SHMEM_H
#include <t8.h>
#include <sc_shmem.h>
typedef struct t8_shmem_array *t8_shmem_array_t;
/* TODO: Change it as soon as we do not always need basic */
#if defined(__bgq__)
#define T8_SHMEM_BEST_TYPE SC_SHMEM_BGQ
#elif defined(SC_ENABLE_MPIWINSHARED)
#define T8_SHMEM_BEST_TYPE SC_SHMEM_WINDOW
#else
#define T8_SHMEM_BEST_TYPE SC_SHMEM_BASIC
#endif
T8_EXTERN_C_BEGIN ();
int
t8_shmem_init (sc_MPI_Comm comm);
#if T8_ENABLE_DEBUG
/* If you need this function outside of debugging mode, feel free
* to remove the macro protection. */
int
t8_shmem_array_is_initialized (const t8_shmem_array_t array);
#endif
void
t8_shmem_finalize (sc_MPI_Comm comm);
void
t8_shmem_set_type (sc_MPI_Comm comm, sc_shmem_type_t type);
void
t8_shmem_array_init (t8_shmem_array_t *parray, size_t elem_size, size_t elem_count, sc_MPI_Comm comm);
int
t8_shmem_array_start_writing (t8_shmem_array_t array);
void
t8_shmem_array_end_writing (t8_shmem_array_t array);
void
t8_shmem_array_set_gloidx (t8_shmem_array_t array, int index, t8_gloidx_t value);
void
t8_shmem_array_copy (t8_shmem_array_t dest, t8_shmem_array_t source);
void
t8_shmem_array_allgather (const void *sendbuf, int sendcount, sc_MPI_Datatype sendtype, t8_shmem_array_t recvarray,
int recvcount, sc_MPI_Datatype recvtype);
void
t8_shmem_array_allgatherv (void *sendbuf, const int sendcount, sc_MPI_Datatype sendtype, t8_shmem_array_t recvarray,
sc_MPI_Datatype recvtype, sc_MPI_Comm comm);
void
t8_shmem_array_prefix (const void *sendbuf, t8_shmem_array_t recvarray, const int count, sc_MPI_Datatype type,
sc_MPI_Op op, sc_MPI_Comm comm);
sc_MPI_Comm
t8_shmem_array_get_comm (t8_shmem_array_t array);
size_t
t8_shmem_array_get_elem_size (t8_shmem_array_t array);
size_t
t8_shmem_array_get_elem_count (t8_shmem_array_t array);
const t8_gloidx_t *
t8_shmem_array_get_gloidx_array (t8_shmem_array_t array);
t8_gloidx_t *
t8_shmem_array_get_gloidx_array_for_writing (t8_shmem_array_t array);
t8_gloidx_t
t8_shmem_array_get_gloidx (t8_shmem_array_t array, int index);
const void *
t8_shmem_array_get_array (t8_shmem_array_t array);
const void *
t8_shmem_array_index (t8_shmem_array_t array, size_t index);
void *
t8_shmem_array_index_for_writing (t8_shmem_array_t array, size_t index);
int
t8_shmem_array_is_equal (t8_shmem_array_t array_a, t8_shmem_array_t array_b);
void
t8_shmem_array_destroy (t8_shmem_array_t *parray);
int
t8_shmem_array_binary_search (t8_shmem_array_t array, const t8_gloidx_t value, const int size,
int (*compare) (t8_shmem_array_t, const int, const t8_gloidx_t));
T8_EXTERN_C_END ();
#endif /* !T8_SHMEM_H */