cuda 0.5.0.2 → 0.5.1.0
raw patch · 17 files changed
+94/−56 lines, 17 files
Files
- Foreign/CUDA/Analysis/Device.chs +21/−20
- Foreign/CUDA/Driver/Context.chs +0/−1
- Foreign/CUDA/Driver/Device.chs +0/−1
- Foreign/CUDA/Driver/Error.chs +2/−2
- Foreign/CUDA/Driver/Event.chs +0/−1
- Foreign/CUDA/Driver/Exec.chs +1/−1
- Foreign/CUDA/Driver/Marshal.chs +0/−1
- Foreign/CUDA/Driver/Module.chs +0/−1
- Foreign/CUDA/Driver/Stream.chs +0/−1
- Foreign/CUDA/Driver/Texture.chs +0/−1
- Foreign/CUDA/Driver/Utils.chs +1/−1
- Foreign/CUDA/Runtime/Error.chs +2/−1
- cbits/stubs.h +10/−0
- configure +29/−15
- configure.ac +21/−7
- cuda.buildinfo.in +2/−1
- cuda.cabal +5/−1
Foreign/CUDA/Analysis/Device.chs view
@@ -16,7 +16,7 @@ ) where -#include <cuda.h>+#include "cbits/stubs.h" import Data.Int import Debug.Trace@@ -121,17 +121,18 @@ data Allocation = Warp | Block data DeviceResources = DeviceResources {- threadsPerWarp :: !Int, -- ^ Warp size- threadsPerMP :: !Int, -- ^ Maximum number of in-flight threads on a multiprocessor- threadBlocksPerMP :: !Int, -- ^ Maximum number of thread blocks resident on a multiprocessor- warpsPerMP :: !Int, -- ^ Maximum number of in-flight warps per multiprocessor- coresPerMP :: !Int, -- ^ Number of SIMD arithmetic units per multiprocessor- sharedMemPerMP :: !Int, -- ^ Total amount of shared memory per multiprocessor (bytes)- sharedMemAllocUnit :: !Int, -- ^ Shared memory allocation unit size (bytes)- regFileSize :: !Int, -- ^ Total number of registers in a multiprocessor- regAllocUnit :: !Int, -- ^ Register allocation unit size- regAllocWarp :: !Int, -- ^ Register allocation granularity for warps- allocation :: !Allocation -- ^ How multiprocessor resources are divided+ threadsPerWarp :: !Int, -- ^ Warp size+ threadsPerMP :: !Int, -- ^ Maximum number of in-flight threads on a multiprocessor+ threadBlocksPerMP :: !Int, -- ^ Maximum number of thread blocks resident on a multiprocessor+ warpsPerMP :: !Int, -- ^ Maximum number of in-flight warps per multiprocessor+ coresPerMP :: !Int, -- ^ Number of SIMD arithmetic units per multiprocessor+ sharedMemPerMP :: !Int, -- ^ Total amount of shared memory per multiprocessor (bytes)+ sharedMemAllocUnit :: !Int, -- ^ Shared memory allocation unit size (bytes)+ regFileSize :: !Int, -- ^ Total number of registers in a multiprocessor+ regAllocUnit :: !Int, -- ^ Register allocation unit size+ regAllocWarp :: !Int, -- ^ Register allocation granularity for warps+ regPerThread :: !Int, -- ^ Maximum number of registers per thread+ allocation :: !Allocation -- ^ How multiprocessor resources are divided } @@ -144,14 +145,14 @@ -- This is mostly extracted from tables in the CUDA occupancy calculator. -- resources compute = case compute of- Compute 1 0 -> DeviceResources 32 768 8 24 8 16384 512 8192 256 2 Block -- Tesla G80- Compute 1 1 -> DeviceResources 32 768 8 24 8 16384 512 8192 256 2 Block -- Tesla G8x- Compute 1 2 -> DeviceResources 32 1024 8 32 8 16384 512 16384 512 2 Block -- Tesla G9x- Compute 1 3 -> DeviceResources 32 1024 8 32 8 16384 512 16384 512 2 Block -- Tesla GT200- Compute 2 0 -> DeviceResources 32 1536 8 48 32 49152 128 32768 64 2 Warp -- Fermi GF100- Compute 2 1 -> DeviceResources 32 1536 8 48 48 49152 128 32768 64 2 Warp -- Fermi GF10x- Compute 3 0 -> DeviceResources 32 2048 16 64 192 49152 256 65536 256 4 Warp -- Kepler GK10x- Compute 3 5 -> DeviceResources 32 2048 16 64 192 49152 256 65536 256 4 Warp -- Kepler GK11x+ Compute 1 0 -> DeviceResources 32 768 8 24 8 16384 512 8192 256 2 124 Block -- Tesla G80+ Compute 1 1 -> DeviceResources 32 768 8 24 8 16384 512 8192 256 2 124 Block -- Tesla G8x+ Compute 1 2 -> DeviceResources 32 1024 8 32 8 16384 512 16384 512 2 124 Block -- Tesla G9x+ Compute 1 3 -> DeviceResources 32 1024 8 32 8 16384 512 16384 512 2 124 Block -- Tesla GT200+ Compute 2 0 -> DeviceResources 32 1536 8 48 32 49152 128 32768 64 2 63 Warp -- Fermi GF100+ Compute 2 1 -> DeviceResources 32 1536 8 48 48 49152 128 32768 64 2 63 Warp -- Fermi GF10x+ Compute 3 0 -> DeviceResources 32 2048 16 64 192 49152 256 65536 256 4 63 Warp -- Kepler GK10x+ Compute 3 5 -> DeviceResources 32 2048 16 64 192 49152 256 65536 256 4 255 Warp -- Kepler GK11x -- Something might have gone wrong, or the library just needs to be -- updated for the next generation of hardware, in which case we just want
Foreign/CUDA/Driver/Context.chs view
@@ -28,7 +28,6 @@ ) where -#include <cuda.h> #include "cbits/stubs.h" {# context lib="cuda" #}
Foreign/CUDA/Driver/Device.chs view
@@ -21,7 +21,6 @@ ) where -#include <cuda.h> #include "cbits/stubs.h" {# context lib="cuda" #}
Foreign/CUDA/Driver/Error.chs view
@@ -18,7 +18,7 @@ import Data.Typeable import Control.Exception -#include <cuda.h>+#include "cbits/stubs.h" {# context lib="cuda" #} @@ -147,7 +147,7 @@ -- {-# INLINE resultIfOk #-} resultIfOk :: (Status, a) -> IO a-resultIfOk (status,result) =+resultIfOk (status, !result) = case status of Success -> return result _ -> throwIO (ExitCode status)
Foreign/CUDA/Driver/Event.chs view
@@ -20,7 +20,6 @@ ) where -#include <cuda.h> #include "cbits/stubs.h" {# context lib="cuda" #}
Foreign/CUDA/Driver/Exec.chs view
@@ -22,7 +22,7 @@ ) where -#include <cuda.h>+#include "cbits/stubs.h" {# context lib="cuda" #} -- Friends
Foreign/CUDA/Driver/Marshal.chs view
@@ -40,7 +40,6 @@ ) where -#include <cuda.h> #include "cbits/stubs.h" {# context lib="cuda" #}
Foreign/CUDA/Driver/Module.chs view
@@ -18,7 +18,6 @@ ) where -#include <cuda.h> #include "cbits/stubs.h" {# context lib="cuda" #}
Foreign/CUDA/Driver/Stream.chs view
@@ -19,7 +19,6 @@ ) where -#include <cuda.h> #include "cbits/stubs.h" {# context lib="cuda" #}
Foreign/CUDA/Driver/Texture.chs view
@@ -25,7 +25,6 @@ ) where -#include <cuda.h> #include "cbits/stubs.h" {# context lib="cuda" #}
Foreign/CUDA/Driver/Utils.chs view
@@ -12,7 +12,7 @@ module Foreign.CUDA.Driver.Utils (driverVersion) where -#include <cuda.h>+#include "cbits/stubs.h" {# context lib="cuda" #} -- Friends
Foreign/CUDA/Runtime/Error.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE BangPatterns #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE ForeignFunctionInterface #-} --------------------------------------------------------------------------------@@ -96,7 +97,7 @@ -- {-# INLINE resultIfOk #-} resultIfOk :: (Status, a) -> IO a-resultIfOk (status,result) =+resultIfOk (status, !result) = case status of Success -> return result _ -> throwIO (ExitCode status)
cbits/stubs.h view
@@ -5,6 +5,16 @@ #ifndef C_STUBS_H #define C_STUBS_H +/*+ * We need to work around some shortcomings in the C parser of c2hs by disabling advanced attributes etc on Apple platforms.+ */+#ifdef __APPLE__ +#define _ANSI_SOURCE+#define __AVAILABILITY__+#define __OSX_AVAILABLE_STARTING(_mac, _iphone)+#define __OSX_AVAILABLE_BUT_DEPRECATED(_macIntro, _macDep, _iphoneIntro, _iphoneDep) +#endif+ #include <cuda.h> #include <cuda_runtime_api.h>
configure view
@@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles.-# Generated by GNU Autoconf 2.69 for Haskell CUDA bindings 0.5.0.0.+# Generated by GNU Autoconf 2.69 for Haskell CUDA bindings 0.5.1.0. # # Report bugs to <tmcdonell@cse.unsw.edu.au>. #@@ -580,8 +580,8 @@ # Identity of this package. PACKAGE_NAME='Haskell CUDA bindings' PACKAGE_TARNAME='cuda'-PACKAGE_VERSION='0.5.0.0'-PACKAGE_STRING='Haskell CUDA bindings 0.5.0.0'+PACKAGE_VERSION='0.5.1.0'+PACKAGE_STRING='Haskell CUDA bindings 0.5.1.0' PACKAGE_BUGREPORT='tmcdonell@cse.unsw.edu.au' PACKAGE_URL='' @@ -624,6 +624,8 @@ ac_subst_vars='LTLIBOBJS LIBOBJS+cuda_frameworks+cuda_lib_path cuda_c2hsflags cuda_ldflags cuda_ccflags@@ -1246,7 +1248,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF-\`configure' configures Haskell CUDA bindings 0.5.0.0 to adapt to many kinds of systems.+\`configure' configures Haskell CUDA bindings 0.5.1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1312,16 +1314,16 @@ if test -n "$ac_init_help"; then case $ac_init_help in- short | recursive ) echo "Configuration of Haskell CUDA bindings 0.5.0.0:";;+ short | recursive ) echo "Configuration of Haskell CUDA bindings 0.5.1.0:";; esac cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)-Haskell compiler-CUDA compiler-C compiler+ --with-compiler=HC use HC as the Haskell compiler+ --with-nvcc=NVCC use NVCC as the CUDA compiler+ --with-gcc=CC use CC as the C compiler Some influential environment variables: CC C compiler command@@ -1399,7 +1401,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF-Haskell CUDA bindings configure 0.5.0.0+Haskell CUDA bindings configure 0.5.1.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc.@@ -1701,7 +1703,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Haskell CUDA bindings $as_me 0.5.0.0, which was+It was created by Haskell CUDA bindings $as_me 0.5.1.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@@@ -3053,7 +3055,8 @@ ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR-for as_dir in $PATH+as_dummy="$PATH:/usr/local/cuda/bin"+for as_dir in $as_dummy do IFS=$as_save_IFS test -z "$as_dir" && as_dir=.@@ -3096,6 +3099,7 @@ cuda_prefix="$(dirname "$(dirname "$NVCC")")" cuda_c2hsflags="--cpp="$NVCC" --cppopts=-E " else+ echo "WARNING: Cannot find the CUDA compiler 'nvcc'. This is likely to cause problems." cuda_prefix="/usr/local/cuda" fi @@ -3103,11 +3107,13 @@ # cuda_inc_path="${cuda_prefix}/include" CPPFLAGS+=" -I${cuda_inc_path} "+cuda_frameworks="" case $target_os in darwin*) cuda_lib_path="${cuda_prefix}/lib"- LDFLAGS+=" -Xlinker -rpath ${cuda_lib_path} "+ cuda_frameworks="CUDA"+ LDFLAGS+=" -Xlinker -rpath ${cuda_lib_path} -F/Library/Frameworks -framework ${cuda_frameworks}" #CPPFLAGS+=" -arch ${target_cpu} " ;; *)@@ -3147,6 +3153,9 @@ # confuses the c2hs preprocessor. We disable this by undefining the __BLOCKS__ # macro. #+# NB: This test doesn't work with newer versions of Xcode/command lines tools anymore.+# However, other CPP magic keeps blocks at bay.+# { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Apple Blocks extension" >&5 $as_echo_n "checking for Apple Blocks extension... " >&6; } if test -r "/usr/include/stdlib.h"; then@@ -3180,6 +3189,9 @@ ********************************************************************************' +# NB: We must use 'AC_CHECK_LIB' (not 'AC_SEARCH_LIBS') for 'libcuda'; otherwise, '-lcuda' is not added to $LIBS with+# CUDA 5.5 on OS X (Mavericks) — I guess, because the library is now only a stub.+# ac_ext=c ac_cpp='$CPP $CPPFLAGS'@@ -3715,6 +3727,7 @@ cuda_ccflags="$CPPFLAGS " cuda_ldflags="$LDFLAGS $LIBS " + for x in $cuda_ccflags; do cuda_ghcflags+="-optc${x} " done@@ -3726,6 +3739,8 @@ ++ cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure@@ -4268,7 +4283,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log="-This file was extended by Haskell CUDA bindings $as_me 0.5.0.0, which was+This file was extended by Haskell CUDA bindings $as_me 0.5.1.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES@@ -4321,7 +4336,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\-Haskell CUDA bindings config.status 0.5.0.0+Haskell CUDA bindings config.status 0.5.1.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -4880,5 +4895,4 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi-
configure.ac view
@@ -1,4 +1,4 @@-AC_INIT([Haskell CUDA bindings], [0.5.0.0], [tmcdonell@cse.unsw.edu.au], [cuda])+AC_INIT([Haskell CUDA bindings], [0.5.1.0], [tmcdonell@cse.unsw.edu.au], [cuda]) AC_CONFIG_SRCDIR([Foreign/CUDA.hs]) AC_CONFIG_FILES([cuda.buildinfo]) AC_PROG_CC@@ -11,9 +11,12 @@ # prefix to the include and library search directories. Additionally, set nvcc # as the C preprocessor for c2hs (only, or it won't try to link cudart) #-AC_ARG_WITH([compiler], [Haskell compiler], [GHC=$withval], [AC_PATH_PROG(GHC, ghc)])-AC_ARG_WITH([nvcc], [CUDA compiler], [NVCC=$withval], [AC_PATH_PROG(NVCC, nvcc)])-AC_ARG_WITH([gcc], [C compiler], [CC=$withval])+AC_ARG_WITH([compiler], [ --with-compiler=HC use HC as the Haskell compiler], + [GHC=$withval], [AC_PATH_PROG(GHC, ghc)])+AC_ARG_WITH([nvcc], [ --with-nvcc=NVCC use NVCC as the CUDA compiler], + [NVCC=$withval], [AC_PATH_PROG(NVCC, nvcc, [], [$PATH:/usr/local/cuda/bin])])+AC_ARG_WITH([gcc], [ --with-gcc=CC use CC as the C compiler], + [CC=$withval]) # If NVCC is detected in the path, set the location of the toolkit relative to # that, otherwise choose the default@@ -22,6 +25,7 @@ cuda_prefix="$(dirname "$(dirname "$NVCC")")" cuda_c2hsflags="--cpp="$NVCC" --cppopts=-E " else+ echo "WARNING: Cannot find the CUDA compiler 'nvcc'. This is likely to cause problems." cuda_prefix="/usr/local/cuda" fi @@ -29,11 +33,13 @@ # cuda_inc_path="${cuda_prefix}/include" CPPFLAGS+=" -I${cuda_inc_path} "+cuda_frameworks="" case $target_os in darwin*) cuda_lib_path="${cuda_prefix}/lib"- LDFLAGS+=" -Xlinker -rpath ${cuda_lib_path} "+ cuda_frameworks="CUDA"+ LDFLAGS+=" -Xlinker -rpath ${cuda_lib_path} -F/Library/Frameworks -framework ${cuda_frameworks}" #CPPFLAGS+=" -arch ${target_cpu} " ;; *)@@ -71,6 +77,9 @@ # confuses the c2hs preprocessor. We disable this by undefining the __BLOCKS__ # macro. #+# NB: This test doesn't work with newer versions of Xcode/command lines tools anymore.+# However, other CPP magic keeps blocks at bay.+# AC_MSG_CHECKING(for Apple Blocks extension) if test -r "/usr/include/stdlib.h"; then BLOCKS=`grep __BLOCKS__ /usr/include/stdlib.h`@@ -101,8 +110,11 @@ ********************************************************************************' +# NB: We must use 'AC_CHECK_LIB' (not 'AC_SEARCH_LIBS') for 'libcuda'; otherwise, '-lcuda' is not added to $LIBS with+# CUDA 5.5 on OS X (Mavericks) — I guess, because the library is now only a stub.+# AC_CHECK_HEADERS([cuda.h cuda_runtime_api.h], [], [AC_MSG_ERROR(could not find CUDA headers${longerror})])-AC_SEARCH_LIBS(cuDriverGetVersion, cuda, [], [AC_MSG_ERROR(could not find CUDA driver library${longerror})])+AC_SEARCH_LIBS(cuDriverGetVersion, cuda, [], [AC_MSG_ERROR(could not find CUDA driver library${longerror})]) AC_SEARCH_LIBS(cudaRuntimeGetVersion, cudart, [], [AC_MSG_ERROR(could not find CUDA runtime library${longerror})]) # Populate the buildinfo, with the search paths and any target specific options@@ -110,6 +122,7 @@ cuda_ccflags="$CPPFLAGS " cuda_ldflags="$LDFLAGS $LIBS " + for x in $cuda_ccflags; do cuda_ghcflags+="-optc${x} " done@@ -121,5 +134,6 @@ AC_SUBST([cuda_ccflags]) AC_SUBST([cuda_ldflags]) AC_SUBST([cuda_c2hsflags])+AC_SUBST([cuda_lib_path])+AC_SUBST([cuda_frameworks]) AC_OUTPUT-
cuda.buildinfo.in view
@@ -2,4 +2,5 @@ cc-options: @cuda_ccflags@ ld-options: @cuda_ldflags@ x-extra-c2hs-options: @cuda_c2hsflags@-+extra-lib-dirs: @cuda_lib_path@+frameworks: @cuda_frameworks@
cuda.cabal view
@@ -1,5 +1,5 @@ Name: cuda-Version: 0.5.0.2+Version: 0.5.1.0 Synopsis: FFI binding to the CUDA interface for programming NVIDIA GPUs Description: The CUDA library provides a direct, general purpose C-like SPMD programming@@ -13,6 +13,8 @@ The configure script will look for your CUDA installation in the standard places, and if the nvcc compiler is found in your PATH, relative to that. .+ /NOTE:/ Mavericks users (OS X 10.9) should use CUDA 5.5.28 and upwards.+ . This release is for version 5.0 of the CUDA toolkit. License: BSD3@@ -20,6 +22,8 @@ Copyright: Copyright (c) [2009..2013]. Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> Author: Trevor L. McDonell <tmcdonell@cse.unsw.edu.au> Maintainer: Trevor L. McDonell <tmcdonell@cse.unsw.edu.au>+Homepage: https://github.com/tmcdonell/cuda+Bug-reports: https://github.com/tmcdonell/cuda/issues Category: Foreign Cabal-version: >= 1.6 Tested-with: GHC >= 7.6