Skip to content

Commit

Permalink
move nbody_GPU_Atomic to its own source file
Browse files Browse the repository at this point in the history
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
  • Loading branch information
tycho committed Mar 6, 2019
1 parent b9403a9 commit 560e526
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/GNUmakefile
Expand Up @@ -161,6 +161,7 @@ SOURCES += \
nbody_GPU_AOS_const.cu \
nbody_GPU_AOS_tiled.cu \
nbody_GPU_AOS_tiled_const.cu \
nbody_GPU_Atomic.cu \
nbody_GPU_Shared.cu \
nbody_GPU_Shuffle.cu \
nbody_GPU_SOA_tiled.cu \
Expand Down
2 changes: 1 addition & 1 deletion src/nbody.cu
Expand Up @@ -72,7 +72,7 @@
//#include "nbody_GPU_SOA_tiled.h"
#include "nbody_GPU_Shared.h"
#include "nbody_GPU_Shuffle.h"
//#include "nbody_GPU_Atomic.cuh"
//#include "nbody_GPU_Atomic.h"
#endif

#ifdef HAVE_SIMD
Expand Down
16 changes: 7 additions & 9 deletions src/nbody_GPU_Atomic.cuh → src/nbody_GPU_Atomic.cu
@@ -1,6 +1,6 @@
/*
*
* nbody_GPU_Atomic.h
* nbody_GPU_Atomic.cu
*
* CUDA implementation of the O(N^2) N-body calculation.
*
Expand Down Expand Up @@ -33,6 +33,11 @@
*
*/

#include "chError.h"
#include "nbody_util.h"
#include "nbody_GPU_Atomic.h"
#include "bodybodyInteraction.cuh"

//
// Atomics only make sense for SM 3.x and higher
//
Expand Down Expand Up @@ -76,14 +81,7 @@ ComputeNBodyGravitation_Atomic( T *force, T *posMass, size_t N, T softeningSquar
}
}


float
ComputeGravitation_GPU_Atomic(
float *force,
float *posMass,
float softeningSquared,
size_t N
)
DEFINE_AOS(ComputeGravitation_GPU_Atomic)
{
cudaError_t status;
cudaEvent_t evStart = 0, evStop = 0;
Expand Down
38 changes: 38 additions & 0 deletions src/nbody_GPU_Atomic.h
@@ -0,0 +1,38 @@
/*
*
* nbody_GPU_Atomic.h
*
* CUDA implementation of the O(N^2) N-body calculation.
*
* Copyright (c) 2011-2012, Archaea Software, LLC.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

DECLARE_AOS(ComputeGravitation_GPU_Atomic);

/* vim: set ts=4 sts=4 sw=4 et: */

0 comments on commit 560e526

Please sign in to comment.