random123

Counter-based Random Number Generators
git clone git://git.meso-star.com/random123.git
Log | Files | Refs | README | LICENSE

openclfeatures.h (2794B)


      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 __openclfeatures_dot_hpp
     33 #define __openclfeatures_dot_hpp
     34 
     35 #ifndef R123_STATIC_INLINE
     36 #define R123_STATIC_INLINE inline
     37 #endif
     38 
     39 #ifndef R123_FORCE_INLINE
     40 #define R123_FORCE_INLINE(decl) decl __attribute__((always_inline))
     41 #endif
     42 
     43 #ifndef R123_CUDA_DEVICE
     44 #define R123_CUDA_DEVICE
     45 #endif
     46 
     47 #ifndef R123_ASSERT
     48 #define R123_ASSERT(x)
     49 #endif
     50 
     51 #ifndef R123_BUILTIN_EXPECT
     52 #define R123_BUILTIN_EXPECT(expr,likely) expr
     53 #endif
     54 
     55 #ifndef R123_USE_GNU_UINT128
     56 #define R123_USE_GNU_UINT128 0
     57 #endif
     58 
     59 #ifndef R123_USE_MULHILO64_ASM
     60 #define R123_USE_MULHILO64_ASM 0
     61 #endif
     62 
     63 #ifndef R123_USE_MULHILO64_MSVC_INTRIN
     64 #define R123_USE_MULHILO64_MSVC_INTRIN 0
     65 #endif
     66 
     67 #ifndef R123_USE_MULHILO64_CUDA_INTRIN
     68 #define R123_USE_MULHILO64_CUDA_INTRIN 0
     69 #endif
     70 
     71 #ifndef R123_USE_MULHILO64_OPENCL_INTRIN
     72 #define R123_USE_MULHILO64_OPENCL_INTRIN 1
     73 #endif
     74 
     75 #ifndef R123_USE_AES_NI
     76 #define R123_USE_AES_NI 0
     77 #endif
     78 
     79 // XXX ATI APP SDK 2.4 clBuildProgram SEGVs if one uses uint64_t instead of
     80 // ulong to mul_hi.  And gets lots of complaints from stdint.h
     81 // on some machines.
     82 // But these typedefs mean we cannot include stdint.h with
     83 // these headers?  Do we need R123_64T, R123_32T, R123_8T?
     84 typedef ulong uint64_t;
     85 typedef uint  uint32_t;
     86 typedef uchar uint8_t;
     87 #define UINT64_C(x) ((ulong)(x##UL))
     88 
     89 #endif