/perf/kseta

To get this branch, use:
bzr branch http://darksoft.org/webbzr/perf/kseta

« back to all changes in this revision

Viewing changes to tutorials/4_pi/random123/features/nvccfeatures.h

  • Committer: Suren A. Chilingaryan
  • Date: 2013-10-08 23:53:50 UTC
  • Revision ID: csa@dside.dyndns.org-20131008235350-hsu8oukzkh05gtcm
Add tutorials

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright 2010-2011, D. E. Shaw Research.
 
3
All rights reserved.
 
4
 
 
5
Redistribution and use in source and binary forms, with or without
 
6
modification, are permitted provided that the following conditions are
 
7
met:
 
8
 
 
9
* Redistributions of source code must retain the above copyright
 
10
  notice, this list of conditions, and the following disclaimer.
 
11
 
 
12
* Redistributions in binary form must reproduce the above copyright
 
13
  notice, this list of conditions, and the following disclaimer in the
 
14
  documentation and/or other materials provided with the distribution.
 
15
 
 
16
* Neither the name of D. E. Shaw Research nor the names of its
 
17
  contributors may be used to endorse or promote products derived from
 
18
  this software without specific prior written permission.
 
19
 
 
20
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
21
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
22
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 
23
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 
24
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
25
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 
26
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 
27
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 
28
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
29
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
30
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
31
*/
 
32
#ifndef __r123_nvcc_features_dot_h__
 
33
#define __r123_nvcc_features_dot_h__
 
34
 
 
35
#if !defined(CUDART_VERSION)
 
36
#error "why are we in nvccfeatures.h if CUDART_VERSION is not defined"
 
37
#endif
 
38
 
 
39
#if CUDART_VERSION < 4010
 
40
#error "CUDA versions earlier than 4.1 produce incorrect results for some templated functions in namespaces.  Random123 isunsupported.  See comments in nvccfeatures.h"
 
41
// This test was added in Random123-1.08 (August, 2013) because we
 
42
// discovered that Ftype(maxTvalue<T>()) with Ftype=double and
 
43
// T=uint64_t in examples/uniform.hpp produces -1 for CUDA4.0 and
 
44
// earlier.  We can't be sure this bug doesn't also affect invocations
 
45
// of other templated functions, e.g., essentially all of Random123.
 
46
// Thus, we no longer trust CUDA versions earlier than 4.1 even though
 
47
// we had previously tested and timed Random123 with CUDA 3.x and 4.0.
 
48
// If you feel lucky or desperate, you can change #error to #warning, but
 
49
// please take extra care to be sure that you are getting correct
 
50
// results.
 
51
#endif
 
52
 
 
53
// nvcc falls through to gcc or msvc.  So first define
 
54
// a couple of things and then include either gccfeatures.h
 
55
// or msvcfeatures.h
 
56
 
 
57
#ifndef R123_CUDA_DEVICE
 
58
#define R123_CUDA_DEVICE __device__
 
59
#endif
 
60
 
 
61
#ifndef R123_USE_MULHILO64_CUDA_INTRIN
 
62
#define R123_USE_MULHILO64_CUDA_INTRIN 1
 
63
#endif
 
64
 
 
65
#ifndef R123_ASSERT
 
66
#define R123_ASSERT(x) if((x)) ; else asm("trap;")
 
67
#endif
 
68
 
 
69
#ifndef R123_BUILTIN_EXPECT
 
70
#define R123_BUILTIN_EXPECT(expr,likely) expr
 
71
#endif
 
72
 
 
73
#ifndef R123_USE_AES_NI
 
74
#define R123_USE_AES_NI 0
 
75
#endif
 
76
 
 
77
#ifndef R123_USE_SSE4_2
 
78
#define R123_USE_SSE4_2 0
 
79
#endif
 
80
 
 
81
#ifndef R123_USE_SSE4_1
 
82
#define R123_USE_SSE4_1 0
 
83
#endif
 
84
 
 
85
#ifndef R123_USE_SSE
 
86
#define R123_USE_SSE 0
 
87
#endif
 
88
 
 
89
#ifndef R123_USE_GNU_UINT128
 
90
#define R123_USE_GNU_UINT128 0
 
91
#endif
 
92
 
 
93
#ifndef R123_ULONG_LONG
 
94
// uint64_t, which is what we'd get without this, is
 
95
// not the same as unsigned long long
 
96
#define R123_ULONG_LONG unsigned long long
 
97
#endif
 
98
 
 
99
#ifndef R123_THROW
 
100
// No exceptions in CUDA, at least upto 4.0
 
101
#define R123_THROW(x)    R123_ASSERT(0)
 
102
#endif
 
103
 
 
104
#if defined(__GNUC__)
 
105
#include "gccfeatures.h"
 
106
#elif defined(_MSC_FULL_VER)
 
107
#include "msvcfeatures.h"
 
108
#endif
 
109
 
 
110
#endif