2 Highly Optimized Object-oriented Many-particle Dynamics -- Blue Edition
3 (HOOMD-blue) Open Source Software License Copyright 2009-2014 The Regents of
4 the University of Michigan All rights reserved.
6 HOOMD-blue may contain modifications ("Contributions") provided, and to which
7 copyright is held, by various Contributors who have granted The Regents of the
8 University of Michigan the right to modify and/or distribute such Contributions.
10 You may redistribute, use, and create derivate works of HOOMD-blue, in source
11 and binary forms, provided you abide by the following conditions:
13 * Redistributions of source code must retain the above copyright notice, this
14 list of conditions, and the following disclaimer both in the code and
15 prominently in any materials provided with the distribution.
17 * Redistributions in binary form must reproduce the above copyright notice, this
18 list of conditions, and the following disclaimer in the documentation and/or
19 other materials provided with the distribution.
21 * All publications and presentations based on HOOMD-blue, including any reports
22 or published results obtained, in whole or in part, with HOOMD-blue, will
23 acknowledge its use according to the terms posted at the time of submission on:
24 http://codeblue.umich.edu/hoomd-blue/citations.html
26 * Any electronic documents citing HOOMD-Blue will link to the HOOMD-Blue website:
27 http://codeblue.umich.edu/hoomd-blue/
29 * Apart from the above required attributions, neither the name of the copyright
30 holder nor the names of HOOMD-blue's contributors may be used to endorse or
31 promote products derived from this software without specific prior written
36 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS'' AND
37 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
38 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND/OR ANY
39 WARRANTIES THAT THIS SOFTWARE IS FREE OF INFRINGEMENT ARE DISCLAIMED.
41 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
42 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
43 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
44 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
45 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
46 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
47 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50 // Maintainer: joaander
52 #include "NeighborListGPU.h"
54 #include "Autotuner.h"
56 /*! \file NeighborListGPUBinned.h
57 \brief Declares the NeighborListGPUBinned class
61 #error This header cannot be compiled by nvcc
64 #ifndef __NEIGHBORLISTGPUBINNED_H__
65 #define __NEIGHBORLISTGPUBINNED_H__
67 //! Neighbor list build on the GPU
68 /*! Implements the O(N) neighbor list build on the GPU using a cell list.
70 GPU kernel methods are defined in NeighborListGPUBinned.cuh and defined in NeighborListGPUBinned.cu.
74 class NeighborListGPUBinned
: public NeighborListGPU
77 //! Constructs the compute
78 NeighborListGPUBinned(boost::shared_ptr
<SystemDefinition
> sysdef
,
81 boost::shared_ptr
<CellList
> cl
= boost::shared_ptr
<CellList
>());
84 virtual ~NeighborListGPUBinned();
86 //! Change the cuttoff radius
87 virtual void setRCut(Scalar r_cut
, Scalar r_buff
);
89 //! Set the autotuner period
90 void setTuningParam(unsigned int param
)
95 //! Set autotuner parameters
96 /*! \param enable Enable/disable autotuning
97 \param period period (approximate) in time steps when returning occurs
99 virtual void setAutotunerParams(bool enable
, unsigned int period
)
101 NeighborListGPU::setAutotunerParams(enable
, period
);
102 m_tuner
->setPeriod(period
/10);
103 m_tuner
->setEnabled(enable
);
106 //! Set the maximum diameter to use in computing neighbor lists
107 virtual void setMaximumDiameter(Scalar d_max
);
109 //! Enable/disable body filtering
110 virtual void setFilterBody(bool filter_body
);
112 //! Enable/disable diameter filtering
113 virtual void setFilterDiameter(bool filter_diameter
);
116 boost::shared_ptr
<CellList
> m_cl
; //!< The cell list
117 cudaArray
*dca_cell_adj
; //!< CUDA array for tex2D access to d_cell_adj
118 cudaArray
*dca_cell_xyzf
; //!< CUDA array for tex2D access to d_cell_xyzf
119 cudaArray
*dca_cell_tdb
; //!< CUDA array for tex2D access to d_cell_tdb
120 uint3 m_last_dim
; //!< The last dimensions allocated for the cell list tex2D arrays
121 unsigned int m_last_cell_Nmax
; //!< The last Nmax allocated for the cell list tex2D arrays
122 unsigned int m_block_size
; //!< Block size to execute on the GPU
123 unsigned int m_param
; //!< Kernel tuning parameter
125 boost::scoped_ptr
<Autotuner
> m_tuner
; //!< Autotuner for block size and threads per particle
126 unsigned int m_last_tuned_timestep
; //!< Last tuning timestep
128 //! Builds the neighbor list
129 virtual void buildNlist(unsigned int timestep
);
131 //! Test if the cuda arrays need reallocation
132 bool needReallocateCudaArrays();
134 //! Updates the cudaArray allocations
135 void allocateCudaArrays();
139 //! Exports NeighborListGPUBinned to python
140 void export_NeighborListGPUBinned();