Lattice Microbes 2.5
This is for whole cell modeling
Loading...
Searching...
No Matches
ZDivMultiGPUMapper.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 __ZDIVMULTIGPUMAPPER__
41#define __ZDIVMULTIGPUMAPPER__
42
43#include "MultiGPUMapper.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
51struct neighbor_buffer
52{
54 size_t size;
55};
56
58{
59 dim3 global_pos; // Position in the global lattice that this gpu is associated with
60 dim3 global_dim; // Dimensions in the global lattice that this is responsible for
61
62 dim3 local_dim; // Local GPU dimensions, including all padding
63 dim3 local_authority; // Position in local GPU that begins authoritative data
64
65 int3 dependent_pos; // Position in global lattice where we can get local_dim data
66 // NOTE: Can be negative for periodic conditions
67
74
75 int lb_chunks; // Number of lattice chunks assigned for load balancing
78
80};
81
82
84{
85 private:
86 gpu_info *info;
87 bool periodic_z;
88
89 protected:
90 virtual void initialize();
91 //void copy_from_neighbor(int gpu, int neighbor, void *dptr, int key);
92 //void copy_to_neighbor(int gpu, int neighbor, int key);
93 void stage_in_real(int gpu, void *dptr, void *hptr, unsigned int element_size);
94 void stage_out_real(int gpu, void *hptr, void *dptr);
95
97 int alter_chunks(int gpu, int count);
98
99 public:
100 ZDivMultiGPUMapper(dim3, size_t, int, int, int, int* gl=NULL, bool pz=false, int pages=1);
101 ZDivMultiGPUMapper(int x, int y, int z, size_t, int, int, int, int* gl=NULL, bool pz=false, int pages=1);
103
104 virtual void initialize_gpu(int gpu);
105 dim3 get_global_dim(int gpu);
106 dim3 get_local_dim(int gpu);
107 int3 get_global_offset(int gpu);
108 size_t get_local_size(int gpu);
109 size_t get_authority_size(int gpu);
110 ssize_t get_global_input_offset(int gpu);
112 size_t get_authority_offset(int gpu);
113
114 void stage_in(int gpu, void *dptr, void *hptr);
115 void stage_in_sites(int gpu, void *dptr, void *hptr);
116 void stage_out(int gpu, void *hptr, void *dptr);
117
118 void publish_state(int gpu, int key, cudaStream_t top, cudaStream_t bot, void *dptr = NULL);
119 void refresh(int gpu, void *dptr, int key);
120 virtual void schedule_send(int gpu, void *dptr, int timestamp, int neighbor, cudaStream_t stream);
121 virtual void schedule_recv(int gpu, void *dptr, int timestamp, int neighbor, cudaStream_t stream);
122
123 int map_index_to_gpu(size_t index);
124
125 gpu_info* getinfo(int gpu);
126 unsigned int* gettbuf(int gpu, int key, int neighbor);
127 unsigned int* getrbuf(int gpu, int key, int neighbor);
128};
129
130#endif
#define MCLKR_MAX_NBUFFERS
Definition ZDivMPIGPUMapper.h:49
#define NUM_SHADOWS
Definition ZDivMultiGPUMapper.h:45
#define MCLKR_MAX_NBUFFERS
Definition ZDivMultiGPUMapper.h:49
MultiGPUMapper(dim3 ldim, size_t cellsize, int apron, int overlap, int num_gpus, int *devices, int pages)
int3 get_global_offset(int gpu)
ZDivMultiGPUMapper(dim3, size_t, int, int, int, int *gl=NULL, bool pz=false, int pages=1)
unsigned int * gettbuf(int gpu, int key, int neighbor)
void stage_in_real(int gpu, void *dptr, void *hptr, unsigned int element_size)
dim3 get_local_dim(int gpu)
virtual void schedule_recv(int gpu, void *dptr, int timestamp, int neighbor, cudaStream_t stream)
void stage_out(int gpu, void *hptr, void *dptr)
gpu_info * getinfo(int gpu)
size_t get_authority_offset(int gpu)
virtual void initialize_gpu(int gpu)
void refresh(int gpu, void *dptr, int key)
virtual void initialize()
bool determine_load_balance()
size_t get_local_size(int gpu)
void stage_in(int gpu, void *dptr, void *hptr)
void stage_out_real(int gpu, void *hptr, void *dptr)
dim3 get_global_dim(int gpu)
int alter_chunks(int gpu, int count)
size_t get_global_output_offset(int gpu)
unsigned int * getrbuf(int gpu, int key, int neighbor)
void stage_in_sites(int gpu, void *dptr, void *hptr)
virtual void schedule_send(int gpu, void *dptr, int timestamp, int neighbor, cudaStream_t stream)
ZDivMultiGPUMapper(int x, int y, int z, size_t, int, int, int, int *gl=NULL, bool pz=false, int pages=1)
ssize_t get_global_input_offset(int gpu)
size_t get_authority_size(int gpu)
int map_index_to_gpu(size_t index)
void publish_state(int gpu, int key, cudaStream_t top, cudaStream_t bot, void *dptr=NULL)
Definition ZDivMultiGPUMapper.h:58
neighbor_buffer * read_buffer[NUM_SHADOWS]
Definition ZDivMultiGPUMapper.h:72
int lb_max_chunks
Definition ZDivMultiGPUMapper.h:76
int lb_chunks
Definition ZDivMultiGPUMapper.h:75
int3 dependent_pos
Definition ZDivMultiGPUMapper.h:65
dim3 local_dim
Definition ZDivMultiGPUMapper.h:62
dim3 overlap_send[NUM_SHADOWS]
Definition ZDivMultiGPUMapper.h:69
dim3 overlap_dim
Definition ZDivMultiGPUMapper.h:68
int neighbor[NUM_SHADOWS]
Definition ZDivMultiGPUMapper.h:71
neighbor_buffer * write_buffer[NUM_SHADOWS]
Definition ZDivMultiGPUMapper.h:73
dim3 local_authority
Definition ZDivMultiGPUMapper.h:63
dim3 global_dim
Definition ZDivMultiGPUMapper.h:60
char * tmp_buffer[MCLKR_MAX_NBUFFERS]
Definition ZDivMultiGPUMapper.h:79
float lb_imbalance
Definition ZDivMultiGPUMapper.h:77
dim3 overlap_recv[NUM_SHADOWS]
Definition ZDivMultiGPUMapper.h:70
dim3 global_pos
Definition ZDivMultiGPUMapper.h:59
Definition ZDivMPIGPUMapper.h:53
size_t size
Definition ZDivMPIGPUMapper.h:55
char * buffer[MCLKR_MAX_NBUFFERS]
Definition ZDivMPIGPUMapper.h:54