nbody: make CPU_AOS OpenMP-parallelized

This one's really straightforward since there's no chance of threads stomping
on each other.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
nbody_CPU_AOS: add condition to avoid calculating against self

The 'i == j' condition was impossible in nbody_CPU_SOA, but not here -- it's
definitely possible for us to compare an element against itself, which makes no
sense to do.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
nbody.cu: respect 'nosimd' argument even without crosscheck

It affects other things (such as which algorithms to cycle through when hitting
the spacebar). There's no reason to disrespect it when crosscheck is off.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
nbody: eliminate redundant xmmintrin.h include for CPU_SSE_openmp

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
nbody: GPU_AOS_tiled_const should be conditional on __CUDA_ARCH__ >= 300

This makes it match Shuffle, et. al.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
whitespace: clean up trailing whitespace, convert tabs to spaces

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
nbody: add vim modelines

Tired of whitespace damage.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
nbody: when built without CUDA, invoke NVCC substitute the same as CXX

Also by default make NVCC=CXX, rather than g++.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
Revert "drop USE_OPENMP flag, use _OPENMP instead, since it indicates compiler support"

This reverts commit 40ce6e8a977aeb185116419910e2c1fce17c450f.

Since 'nvcc' is the compiler for nbody.cu, it doesn't see the _OPENMP define
which was present in the source compilation of the OpenMP implementation. We
can't depend on the _OPENMP macro's existence to determine how the non-CUDA
portions were compiled.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
nbody: make template function ComputeGravitation_AOS_tiled static

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
nbody: simplify ComputeGravitation_AOS_tiled inner non-diagonal loop

It did an extra iteration where it wasn't necessary, since we specifically
exclude that iteration from running.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
nbody_CPU_AOS_tiled: bump tile size to 128x128

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
nbody: parallelize CPU_AOS_tiled with OpenMP

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
nbody: use unsigned types for iterators

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
nbody: detect compiler support for OpenMP before enabling it

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
nbody_CPU_AOS_tiled: make functions static

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
nbody: make pos/mass arguments to ComputeGravitation constant

This prevents us from making errors in our code to an extent, and also gives
the compiler a bit more room to optimize.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
nbody: parallelize CPU_SOA with OpenMP

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
nbody: make CPU_AOS vectorizable in ICC

It wasn't correctly vectorizing with #pragma simd before, because the 'acc'
variable was an array. Breaking it out into x/y/z seems to make it vectorize
correctly and vastly improve throughput.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
nbody.cu: fix printf warning (%d used where %zu needed for size_t)

Signed-off-by: Steven Noonan <steven@uplinklabs.net>