Lattice Microbes 2.5
This is for whole cell modeling
Loading...
Searching...
No Matches
CudaIntLattice.h
Go to the documentation of this file.
1/*
2 * University of Illinois Open Source License
3 * Copyright 2008-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): Elijah Roberts
38 */
39
40#ifndef LM_RDME_CUDAINTLATTICE_H_
41#define LM_RDME_CUDAINTLATTICE_H_
42
43#include <vector>
44#include <map>
45#include "core/Exceptions.h"
46#include "cuda/lm_cuda.h"
47#include "rdme/IntLattice.h"
48#include "rdme/Lattice.h"
49
50namespace lm {
51namespace rdme {
52
54{
55public:
58 virtual ~CudaIntLattice();
59
60 virtual void copyToGPU();
61 virtual void copyFromGPU();
62 virtual void * getGPUMemorySrc();
63 virtual void * getGPUMemoryDest();
64 virtual void swapSrcDest();
65 virtual void * getGPUMemorySiteTypes();
66
67 // Override methods that can cause the GPU memory to become stale.
69 virtual void setSiteType(lattice_size_t index, site_t site);
71 virtual void addParticle(lattice_size_t index, particle_t particle);
73 virtual void removeParticles(lattice_size_t index);
74 virtual void removeAllParticles();
75
76 // Methods to set the data directly.
77 virtual void setFromRowMajorByteData(void * buffer, size_t bufferSize);
78
79protected:
80 virtual void allocateCudaMemory();
81 virtual void deallocateCudaMemory();
82
83protected:
86 void * cudaParticles[2];
90};
91
92}
93}
94
95#endif
uint32_t particle_t
Definition ByteLatticeExtended.h:19
uint32_t lattice_size_t
Definition Lattice.h:55
uint32_t site_t
Definition Lattice.h:74
double si_dist_t
Definition Types.h:63
unsigned int uint
Definition Types.h:52
bool isGPUMemorySynched
Definition CudaIntLattice.h:89
uint cudaParticlesCurrent
Definition CudaIntLattice.h:84
virtual void removeAllParticles()
Empty all particles from the specified site.
virtual void * getGPUMemorySrc()
virtual void allocateCudaMemory()
virtual void addParticle(lattice_size_t x, lattice_size_t y, lattice_size_t z, particle_t particle)
Add a particle to the specified site.
virtual void setSiteType(lattice_size_t x, lattice_size_t y, lattice_size_t z, site_t site)
Set the site type at the specified location.
virtual void setFromRowMajorByteData(void *buffer, size_t bufferSize)
virtual void setSiteType(lattice_size_t index, site_t site)
Set the site type at the specified location.
virtual void copyFromGPU()
virtual void copyToGPU()
size_t cudaSiteTypesSize
Definition CudaIntLattice.h:87
virtual void removeParticles(lattice_size_t index)
Remove a particle to the specified site.
size_t cudaParticlesSize
Definition CudaIntLattice.h:85
virtual void * getGPUMemoryDest()
virtual void swapSrcDest()
void * cudaSiteTypes
Definition CudaIntLattice.h:88
virtual void deallocateCudaMemory()
virtual void addParticle(lattice_size_t index, particle_t particle)
Add a particle to the specified site.
CudaIntLattice(lattice_coord_t size, si_dist_t spacing, uint particlesPerSite)
void * cudaParticles[2]
Definition CudaIntLattice.h:86
CudaIntLattice(lattice_size_t xSize, lattice_size_t ySize, lattice_size_t zSize, si_dist_t spacing, uint particlesPerSite)
virtual void removeParticles(lattice_size_t x, lattice_size_t y, lattice_size_t z)
Remove a particle to the specified site.
virtual void * getGPUMemorySiteTypes()
IntLattice(lattice_coord_t size, si_dist_t spacing, uint particlesPerSite)
Definition IntLattice.cpp:58
lattice_coord_t size
Definition Lattice.h:256
si_dist_t spacing
Definition Lattice.h:258
Definition LatticeBuilder.h:60
Definition Capsule.cpp:46
Type to store a lattice coordinate.
Definition Lattice.h:59