Fenix @develop
 
Loading...
Searching...
No Matches
fenix_data_subset.h
1/*
2//@HEADER
3// ************************************************************************
4//
5//
6// _|_|_|_| _|_|_|_| _| _| _|_|_| _| _|
7// _| _| _|_| _| _| _| _|
8// _|_|_| _|_|_| _| _| _| _| _|
9// _| _| _| _|_| _| _| _|
10// _| _|_|_|_| _| _| _|_|_| _| _|
11//
12//
13//
14//
15// Copyright (C) 2016 Rutgers University and Sandia Corporation
16//
17// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18// the U.S. Government retains certain rights in this software.
19//
20// Redistribution and use in source and binary forms, with or without
21// modification, are permitted provided that the following conditions are
22// met:
23//
24// 1. Redistributions of source code must retain the above copyright
25// notice, this list of conditions and the following disclaimer.
26//
27// 2. Redistributions in binary form must reproduce the above copyright
28// notice, this list of conditions and the following disclaimer in the
29// documentation and/or other materials provided with the distribution.
30//
31// 3. Neither the name of the Corporation nor the names of the
32// contributors may be used to endorse or promote products derived from
33// this software without specific prior written permission.
34//
35// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
36// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
38// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
39// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
40// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
41// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
42// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
43// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
44// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
45// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46//
47// Author Marc Gamell, Eric Valenzuela, Keita Teranishi, Manish Parashar,
48// Michael Heroux, and Matthew Whitlock
49//
50// Questions? Contact Keita Teranishi (knteran@sandia.gov) and
51// Marc Gamell (mgamell@cac.rutgers.edu)
52//
53// ************************************************************************
54//@HEADER
55*/
56#ifndef __FENIX_DATA_SUBSET_H__
57#define __FENIX_DATA_SUBSET_H__
58#include <mpi.h>
59
60#define __FENIX_SUBSET_EMPTY 1
61#define __FENIX_SUBSET_FULL 2
62#define __FENIX_SUBSET_CREATE 3
63#define __FENIX_SUBSET_CREATEV 4
64#define __FENIX_SUBSET_UNDEFINED -1
65
66
67//Specifier speeds up the process by letting us know if this is a simple
68//subset in which each region is repeated w/ same stride, or if each
69//region is never repeated (EG create vs createv). Also has specifiers for
70//FULL/EMPTY.
71typedef struct {
72 int num_blocks;
73 int* start_offsets;
74 int* end_offsets;
75 int* num_repeats;
76 int stride;
77 int specifier;
79
80int __fenix_data_subset_init(int num_blocks, Fenix_Data_subset* subset);
81int __fenix_data_subset_create(int, int, int, int, Fenix_Data_subset *);
82int __fenix_data_subset_createv(int, int *, int *, Fenix_Data_subset *);
83void __fenix_data_subset_deep_copy(Fenix_Data_subset* from, Fenix_Data_subset* to);
84void __fenix_data_subset_merge(Fenix_Data_subset* first_subset,
85 Fenix_Data_subset* second_subset, Fenix_Data_subset* output);
86void __fenix_data_subset_merge_inplace(Fenix_Data_subset* first_subset,
87 Fenix_Data_subset* second_subset);
88void __fenix_data_subset_copy_data(Fenix_Data_subset* ss, void* dest,
89 void* src, size_t data_type_size, size_t max_size);
90int __fenix_data_subset_data_size(Fenix_Data_subset* ss, size_t max_size);
91void* __fenix_data_subset_serialize(Fenix_Data_subset* ss, void* src,
92 size_t type_size, size_t max_size, size_t* output_size);
93void __fenix_data_subset_deserialize(Fenix_Data_subset* ss, void* src,
94 void* dest, size_t max_size, size_t type_size);
95void __fenix_data_subset_send(Fenix_Data_subset* ss, int dest, int tag, MPI_Comm comm);
96void __fenix_data_subset_recv(Fenix_Data_subset* ss, int src, int tag, MPI_Comm comm);
97int __fenix_data_subset_is_full(Fenix_Data_subset* ss, size_t data_length);
98int __fenix_data_subset_free(Fenix_Data_subset *);
99int __fenix_data_subset_delete(Fenix_Data_subset *);
100
101#endif // FENIX_DATA_SUBSET_H
Definition fenix_data_subset.h:71