cuda: FFI binding to the CUDA interface for programming NVIDIA GPUs

[ bsd3, foreign, library, program ] [ Propose Tags ] [ Report a vulnerability ]

The CUDA library provides a direct, general purpose C-like SPMD programming model for NVIDIA graphics cards (G8x series onwards). This is a collection of bindings to allow you to call and control, although not write, such functions from Haskell-land. You will need to install the CUDA driver and developer toolkit.

http://developer.nvidia.com/cuda-downloads

The setup script will look for your CUDA installation by checking, in the following order:

  1. The CUDA_PATH environment variable

  2. Searching for nvcc on the PATH

  3. Checking at /usr/local/cuda

  4. CUDA_PATH_Vx_y environment variable, for recent CUDA toolkit versions x.y

This library provides bindings to both the CUDA Driver and Runtime APIs. To get started, see one of:

Tested with library versions up to CUDA-11.4. See also the travis-ci.org build matrix for version compatibility.

NOTES:

The setup script for this package requires at least Cabal-1.24. To upgrade, execute one of:

  • cabal users: cabal install Cabal --constraint="Cabal >= 1.24"

  • stack users: stack setup --upgrade-cabal

Due to an interaction between GHC-8 and unified virtual address spaces in CUDA, this package does not currently work with GHCi on ghc-8.0.1 (compiled programs should work). See the following for more details:

The bug should be fixed in ghc-8.0.2 and beyond.

For additional notes on installing on Windows, see:


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1, 0.2, 0.2.1, 0.2.2, 0.3.2, 0.3.2.1, 0.3.2.2, 0.4.0.0, 0.4.0.1, 0.4.0.2, 0.4.1.0, 0.4.1.1, 0.5.0.0, 0.5.0.1, 0.5.0.2, 0.5.1.0, 0.5.1.1, 0.6.0.0, 0.6.0.1, 0.6.5.0, 0.6.5.1, 0.6.6.0, 0.6.6.1, 0.6.6.2, 0.6.7.0, 0.7.0.0, 0.7.5.0, 0.7.5.1, 0.7.5.2, 0.7.5.3, 0.8.0.0, 0.8.0.1, 0.9.0.0, 0.9.0.1, 0.9.0.2, 0.9.0.3, 0.10.0.0, 0.10.1.0, 0.10.2.0, 0.11.0.0, 0.11.0.1 (info)
Change log CHANGELOG.md
Dependencies base (>=4.7 && <5), bytestring (>=0.10.4), cuda, filepath (>=1.0), pretty, template-haskell, uuid-types (>=1.0) [details]
Tested with ghc >=8.0
License BSD-3-Clause
Copyright Copyright (c) [2009..2023]. Trevor L. McDonell <trevor.mcdonell@gmail.com>
Author Trevor L. McDonell <trevor.mcdonell@gmail.com>
Maintainer Trevor L. McDonell <trevor.mcdonell@gmail.com>
Category Foreign
Home page https://github.com/tmcdonell/cuda
Bug tracker https://github.com/tmcdonell/cuda/issues
Source repo head: git clone https://github.com/tmcdonell/cuda
this: git clone https://github.com/tmcdonell/cuda(tag v0.11.0.1)
Uploaded by TrevorMcDonell at 2023-08-15T12:58:35Z
Distributions LTSHaskell:0.11.0.1, Stackage:0.11.0.1
Reverse Dependencies 16 direct, 47 indirect [details]
Executables nvidia-device-query
Downloads 37365 total (156 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for cuda-0.11.0.1

[back to package description]

Haskell FFI Bindings to CUDA

CI-Linux CI-Windows Stackage LTS Stackage Nightly Hackage

The CUDA library provides a direct, general purpose C-like SPMD programming model for NVIDIA graphics cards (G8x series onwards). This is a collection of bindings to allow you to call and control, although not write, such functions from Haskell-land. You will need to install the CUDA driver and developer toolkit.

http://developer.nvidia.com/object/cuda.html

The configure step will look for your CUDA installation in the standard places, and if the nvcc compiler is found in your PATH, relative to that.

For important information on installing on Windows, see:

https://github.com/tmcdonell/cuda/blob/master/WINDOWS.md

Missing functionality

An incomplete list of missing bindings. Pull requests welcome!

CUDA-9

  • cuLaunchCooperativeKernelMultiDevice

CUDA-10.0

  • cuDeviceGetLuid (windows only?)
  • cuLaunchHostFunc
  • cuGraphHostNode[Get/Set]Params
  • cuGraphKernelNode[Get/Set]Params
  • cuGraphMemcpyNode[Get/Set]Params
  • cuGraphMemsetNode[Get/Set]Params

CUDA-10.2

  • cuDeviceGetNvSciSyncAttributes
  • cuMemAddressFree
  • cuMemAddressReserve
  • cuMemCreate
  • cuMemExportToShareableHandle
  • cuMemGetAccess
  • cuMemGetAllocationGranularity
  • cuMemGetAllocationPrepertiesFromHandle
  • cuMemImportFromShareableHandle
  • cuMemMap
  • cuMemRelease
  • cuMemSetAccess
  • cuMemUnmap
  • cuGraphExecHostNodeSetParams
  • cuGraphExecMemcpyNodeSetParams
  • cuGraphExecMemsetNodeSetParams
  • cuGraphExecUpdate

CUDA-11.0

  • cuCtxResetPersistentingL2Cache
  • cuMemRetainAllocationHandle
  • cuStreamCopyAttributes
  • cuStreamGetAttribute
  • cuStreamSetAttribute
  • cuGraphKernelNodeCopyAttributes
  • cuGraphKernelNodeGetAttribute
  • cuGraphKernelNodeSetAttribute
  • cuOccupancyAvailableDynamicSMemPerBlock

CUDA-11.1

  • cuDeviceGetTexture1DLinearMaxWidth
  • cuArrayGetSparseProperties
  • cuMipmappedArrayGetSparseProperties
  • cuMemMapArrayAsync
  • cuEventRecordWithFlags
  • cuGraphAddEventRecordNode
  • cuGraphAddEventWaitNode
  • cuGraphEventRecordNodeGetEvent
  • cuGraphEventRecordNodeSetEvent
  • cuGraphEventWaitNodeGetEvent
  • cuGraphEventWaitNodeSetEvent
  • cuGraphExecChildGraphNodeSetParams
  • cuGraphExecEventRecordNodeSetEvent
  • cuGraphExecEventWaitNodeSetEvent
  • cuGraphUpload

CUDA-11.2

  • cuDeviceGetDefaultMemPool
  • cuDeviceGetMemPool
  • cuDeviceSetMemPool
  • cuArrayGetPlane
  • cuMemAllocAsync
  • cuMemAllocFromPoolAsync
  • cuMemFreeAsync
  • cuMemPoolCreate
  • cuMemPoolDestroy
  • cuMemPoolExportPointer
  • cuMemPoolExportToShareableHandle
  • cuMemPoolGetAccess
  • cuMemPoolGetAttribute
  • cuMemPoolImportFromShareableHandle
  • cuMemPoolImportPointer
  • cuMemPoolSetAccess
  • cuMemPoolSetAttribute
  • cuMemPoolTrimTo
  • cuGraphAddExternalSemaphoresSignalNode
  • cuGraphAddExternalSemaphoresWaitNode
  • cuGraphExecExternalSemaphoresSignalNodeSetParams
  • cuGraphExecExternalSemaphoresWaitNodeSetParams
  • cuGraphExternalSemaphoresSignalNodeGetParams
  • cuGraphExternalSemaphoresSignalNodeSetParams
  • cuGraphExternalSemaphoresWaitNodeGetParams
  • cuGraphExternalSemaphoresWaitNodeSetParams

CUDA-11.3

  • cuStreamGetCaptureInfo_v2
  • cuFuncGetModule
  • cuGraphDebugDotPrint
  • cuGraphReleaseUserObject
  • cuGraphRetainUserObject
  • cuUserObjectCreate
  • cuUserObjectRelease
  • cuUserObjectRetain
  • cuGetProcAddress

CUDA-11.4

  • cuDeviceGetUuid_v2
  • cuCtxCreate_v3
  • cuCtxGetExecAffinity
  • cuDeviceGetGraphMemAttribute
  • cuDeviceGraphMemTrim
  • cuDeviceSetGraphMemAttribute
  • cuGraphAddMemAllocNode
  • cuGraphAddMemFreeNode
  • cuGraphInstantiateWithFlags
  • cuGraphMemAllocNodeGetParams
  • cuGraphMemFreeNodeGetParams