packages feed

hasktorch-CudaHashMap-0.1.0.0: hasktorch-CudaHashMap.cabal

cabal-version:      3.0
-- The cabal-version field refers to the version of the .cabal specification,
-- and can be different from the cabal-install (the tool) version and the
-- Cabal (the library) version you are using. As such, the Cabal (the library)
-- version used must be equal or greater than the version stated in this field.
-- Starting from the specification version 2.2, the cabal-version field must be
-- the first thing in the cabal file.

-- Initial package description 'hasktorch-CudaHashMap' generated by
-- 'cabal init'. For further documentation, see:
--   http://haskell.org/cabal/users-guide/
--
-- The name of the package.
name:               hasktorch-CudaHashMap

-- The package version.
-- See the Haskell package versioning policy (PVP) for standards
-- guiding when and how versions should be incremented.
-- https://pvp.haskell.org
-- PVP summary:     +-+------- breaking API changes
--                  | | +----- non-breaking API additions
--                  | | | +--- code changes with no API change
version:            0.1.0.0

-- A short (one-line) description of the package.
synopsis:           HaskTorch interface to the GPU-parallel hashmap in cuCollections

-- A longer description of the package.
-- description:

license:            BSD-3-Clause
license-file:       LICENSE
author:             Susumu Katayama
maintainer:         skata@cs.miyazaki-u.ac.jp

-- A copyright notice.
-- copyright:
category:           Data
build-type:         Custom

-- Extra doc files to be distributed with the package, such as a CHANGELOG or a README.
extra-doc-files:    README.md, CHANGELOG.md

-- Extra source files to be distributed with the package, such as examples, or a tutorial module.
extra-source-files: cbits/cuco_wrapper.cu, cbits/cuco_wrapper.h, cbits/CMakeLists.txt, cbits/cmake/CPM.cmake

custom-setup
    setup-depends:
        base >= 4.7 && < 5,
        Cabal >= 3.0 && < 4,
        directory >= 1.3 && < 2,
        process >= 1.6 && < 2

common warnings
    ghc-options: -Wall

library
    -- Import common warning flags.
    import:           warnings

    exposed-modules:     Torch.CudaHashMap
    hs-source-dirs:      src
    default-language:    Haskell2010
--    ghc-options:         -Wall

    build-depends:       base >= 4.7 && < 5
                     , hasktorch
                     , libtorch-ffi

    include-dirs:        cbits

    -- Paths to the precompiled custom library (libcuco_wrapper.a) and CUDA libraries
    -- are automatically resolved as absolute paths in the confHook of Setup.hs.

    -- Libraries to link against
    --    cuco_wrapper: custom C++ wrapper (libcuco_wrapper.a)
    --    cuda, cudart: CUDA runtime
    --    nvrtc: CUDA runtime compilation (required internally by cuco)
    extra-libraries:     cuco_wrapper
                       , cuda
                       , cudart
                       , nvrtc
                       , stdc++

    -- GHC options for C++ and CUDA integration
    --    -pgml g++ : use g++ instead of gcc as the linker driver (required for C++ exception handling and standard library linking)
    --    --copy-dt-needed-entries : allow resolving indirect DSO symbols such as libc10_cuda.so required by libtorch_cuda.so
    ghc-options:         -pgml g++
                         -optl-Wl,--copy-dt-needed-entries


    -- Modules included in this library but not exported.
    -- other-modules:

    -- LANGUAGE extensions used by modules in this package.
    -- other-extensions:


executable CudaHashMap
    import:           warnings
    main-is:          Main.hs
    build-depends:
        base >= 4.7 && < 5,
        hasktorch,
        hasktorch-CudaHashMap

    ghc-options:      -pgml g++
                      -optl-no-pie
                      -optl-Lcbits/build
                      -optl-L/usr/local/cuda/lib64
                      -optl-Wl,--copy-dt-needed-entries

    hs-source-dirs:   app
    default-language: Haskell2010

test-suite CudaHashMap-test
    import:           warnings
    default-language: Haskell2010

    -- The interface type and version of the test suite.
    type:             exitcode-stdio-1.0

    hs-source-dirs:   test
    main-is:          Main.hs

    build-depends:
        base >= 4.7 && < 5,
        hasktorch,
        hasktorch-CudaHashMap

    ghc-options:      -pgml g++
                      -optl-no-pie
                      -optl-Lcbits/build
                      -optl-L/usr/local/cuda/lib64
                      -optl-Wl,--copy-dt-needed-entries

benchmark CudaHashMap-bench
    import:           warnings
    type:             exitcode-stdio-1.0
    hs-source-dirs:   bench
    main-is:          Main.hs
    default-language: Haskell2010

    build-depends:
        base >= 4.7 && < 5,
        clock >= 0.8,
        deepseq >= 1.4,
        hasktorch,
        hasktorch-CudaHashMap,
        unordered-containers >= 0.2

    ghc-options:      -O2
                      -pgml g++
                      -optl-no-pie
                      -optl-Lcbits/build
                      -optl-L/usr/local/cuda/lib64
                      -optl-Wl,--copy-dt-needed-entries