Lattice Microbes 2.5
This is for whole cell modeling
Loading...
Searching...
No Matches
ZDivMPIGPUMapper.h
Go to the documentation of this file.
1/*
2 * University of Illinois Open Source License
3 * Copyright 2012-2018 Luthey-Schulten Group,
4 * All rights reserved.
5 *
6 * Developed by: Luthey-Schulten Group
7 * University of Illinois at Urbana-Champaign
8 * http://www.scs.uiuc.edu/~schulten
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining a copy of
11 * this software and associated documentation files (the Software), to deal with
12 * the Software without restriction, including without limitation the rights to
13 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
14 * of the Software, and to permit persons to whom the Software is furnished to
15 * do so, subject to the following conditions:
16 *
17 * - Redistributions of source code must retain the above copyright notice,
18 * this list of conditions and the following disclaimers.
19 *
20 * - Redistributions in binary form must reproduce the above copyright notice,
21 * this list of conditions and the following disclaimers in the documentation
22 * and/or other materials provided with the distribution.
23 *
24 * - Neither the names of the Luthey-Schulten Group, University of Illinois at
25 * Urbana-Champaign, nor the names of its contributors may be used to endorse or
26 * promote products derived from this Software without specific prior written
27 * permission.
28 *
29 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
32 * THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
33 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
34 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
35 * OTHER DEALINGS WITH THE SOFTWARE.
36 *
37 * Author(s): Mike Hallock
38 */
39
40#ifndef __ZDIVMMPIGPUMAPPER__
41#define __ZDIVMMPIGPUMAPPER__
42
43#include "SegmentDescriptor.h"
44
45#define NUM_SHADOWS 2
46#define Z_SHADOW_TOP 0
47#define Z_SHADOW_BOTTOM 1
48
49#define MCLKR_MAX_NBUFFERS 2
50
51
53{
55 size_t size;
56};
57
59{
60 private:
61 bool periodic_z;
62
63 dim3 global_pos; // Position in the global lattice that this gpu is associated with
64 dim3 global_dim; // Dimensions in the global lattice that this is responsible for
65
66 dim3 local_dim; // Local GPU dimensions, including all padding
67 dim3 local_authority; // Position in local GPU that begins authoritative data
68
69 int3 dependent_pos; // Position in global lattice where we can get local_dim data
70 // NOTE: Can be negative for periodic conditions
71
72 dim3 overlap_dim;
73 dim3 overlap_send[NUM_SHADOWS];
74 dim3 overlap_recv[NUM_SHADOWS];
75 int neighbor[NUM_SHADOWS];
76 neighbor_buffer *comm_buffer[NUM_SHADOWS];
77
78 int rank, world_size, host_gpu;
79//mgpumapper imports
80 dim3 lattice_dim;
81 int overlap, apron;
82 size_t cellsize;
83 int pagecount;
84
85 size_t local_size, global_size;
86 size_t authority_size, authority_offset;
87 ssize_t global_input_offset;
88 size_t global_output_offset;
89
90
91 protected:
92 void stage_in_real(void *dptr, void *hptr, unsigned int element_size);
93 void stage_out_real(void *hptr, void *dptr);
94
95 public:
96 ZDivMPIGPUMapper(int x, int y, int z, size_t, int, int, int, bool pz=false, int pages=1);
98
100 virtual void initialize_gpu();
101
110
111 void stage_in(void *dptr, void *hptr);
112 void stage_in_sites(void *dptr, void *hptr);
113 void stage_out(void *hptr, void *dptr);
114
115/*
116 void publish_state(int gpu, void *dptr, int key);
117 void refresh(int gpu, void *dptr, int key);
118 virtual void schedule_send(int gpu, void *dptr, int timestamp, int neighbor, cudaStream_t stream);
119 virtual void schedule_recv(int gpu, void *dptr, int timestamp, int neighbor, cudaStream_t stream);
120
121 int map_index_to_gpu(size_t index);
122*/
123
124 void communicate_edges(void *dptr, int key);
125 void recv_edge(int key, int neigh);
126 void send_edge(int key, int neigh);
127 void copy_edge_to_device(void *dptr, int key, int neighbor, cudaStream_t s);
128 void copy_edge_to_host(void *dptr, int key, int neighbor, cudaStream_t s);
129 void stage_in_from_slave(int rank, void *hptr);
130 void stage_out_to_master(void *hptr);
131
132};
133
134#endif
struct segmentDescriptor SegmentDescriptor_s
Definition SegmentDescriptor.h:57
#define NUM_SHADOWS
Definition ZDivMPIGPUMapper.h:45
#define MCLKR_MAX_NBUFFERS
Definition ZDivMultiGPUMapper.h:49
void stage_out_real(void *hptr, void *dptr)
void communicate_edges(void *dptr, int key)
void recv_edge(int key, int neigh)
void stage_in_real(void *dptr, void *hptr, unsigned int element_size)
void stage_in_sites(void *dptr, void *hptr)
size_t get_authority_size()
void stage_out(void *hptr, void *dptr)
size_t get_global_output_offset()
void stage_out_to_master(void *hptr)
virtual void initialize_gpu()
void stage_in_from_slave(int rank, void *hptr)
size_t get_local_size()
ZDivMPIGPUMapper(int x, int y, int z, size_t, int, int, int, bool pz=false, int pages=1)
virtual SegmentDescriptor_s * initialize()
void send_edge(int key, int neigh)
ssize_t get_global_input_offset()
int3 get_global_offset()
void stage_in(void *dptr, void *hptr)
size_t get_authority_offset()
void copy_edge_to_device(void *dptr, int key, int neighbor, cudaStream_t s)
void copy_edge_to_host(void *dptr, int key, int neighbor, cudaStream_t s)
Definition ZDivMPIGPUMapper.h:53
size_t size
Definition ZDivMPIGPUMapper.h:55
char * buffer[MCLKR_MAX_NBUFFERS]
Definition ZDivMPIGPUMapper.h:54