|
2 | 2 | fetchFromGitHub, |
3 | 3 | fetchpatch, |
4 | 4 | pkgs, |
5 | | - symlinkJoin, |
6 | 5 | # nativeBuildInputs |
7 | 6 | asmjit, |
8 | 7 | blas, |
|
23 | 22 | mpi, |
24 | 23 | ninja, |
25 | 24 | numactl, |
| 25 | + onnx, |
26 | 26 | protobuf, |
27 | 27 | psimd, |
28 | 28 | pthreadpool, |
|
43 | 43 | useXnnpack ? true, |
44 | 44 | useZstd ? true, |
45 | 45 | }: let |
46 | | - inherit (lib) lists; |
| 46 | + inherit (lib) lists strings; |
47 | 47 | setBool = bool: |
48 | 48 | if bool |
49 | 49 | then "ON" |
|
82 | 82 | }; |
83 | 83 | }); |
84 | 84 |
|
85 | | - cuda-redist = symlinkJoin { |
86 | | - name = "cuda-redist"; |
87 | | - paths = with cudaPackages; |
88 | | - [ |
89 | | - autoAddOpenGLRunpathHook |
90 | | - cuda_cccl # <thrust> and CUB |
91 | | - cuda_cudart |
92 | | - cuda_cupti # Needed by Kineto for GPU profiling |
93 | | - cuda_nvcc |
94 | | - cuda_nvml_dev |
95 | | - cuda_nvrtc |
96 | | - cuda_nvtx |
97 | | - libcublas |
98 | | - libcufft |
99 | | - libcurand |
100 | | - libcusolver |
101 | | - libcusparse |
102 | | - nccl.dev |
103 | | - ] |
104 | | - ++ lists.optionals useCudnn [cudnn]; |
105 | | - }; |
106 | | - |
107 | 85 | mkDerivation = |
108 | 86 | if useCuda |
109 | 87 | then cudaPackages.backendStdenv.mkDerivation |
|
171 | 149 | rm -rf FXdiv* |
172 | 150 | rm -rf gloo* |
173 | 151 | rm -rf ideep/mkl-dnn* |
| 152 | + rm -rf onnx* |
174 | 153 | rm -rf protobuf* |
175 | 154 | rm -rf psimd* |
176 | 155 | rm -rf pthreadpool* |
|
235 | 214 | fxdiv |
236 | 215 | gflags |
237 | 216 | glog |
| 217 | + onnx |
238 | 218 | protobuf |
239 | 219 | psimd |
240 | 220 | pthreadpool |
|
248 | 228 | zlib |
249 | 229 | ] |
250 | 230 | # Optional dependencies |
251 | | - ++ lists.optionals useCuda [cuda-redist] |
| 231 | + ++ lists.optionals useCuda ( |
| 232 | + # TODO(@connorbaker): Is this correct that we need both cudart and nvcc as native dependencies? |
| 233 | + with cudaPackages; [ |
| 234 | + autoAddOpenGLRunpathHook |
| 235 | + cuda_cudart # cuda_runtime.h |
| 236 | + cuda_nvcc # crt/host_config.h |
| 237 | + ] |
| 238 | + ) |
252 | 239 | ++ lists.optionals useGloo [gloo] |
253 | 240 | ++ lists.optionals useMagma [magma] |
254 | 241 | ++ lists.optionals useMkldnn [oneDNN.dev] # oneDNN is the new name for MKL-DNN |
|
257 | 244 | ++ lists.optionals useXnnpack [xnnpack] |
258 | 245 | ++ lists.optionals useZstd [zstd.dev]; |
259 | 246 |
|
| 247 | + # TODO(@connorbaker): Currently CUDA build fails with: |
| 248 | + # CMake Error at cmake/public/cuda.cmake:65 (message): |
| 249 | + # Found two conflicting CUDA installs: |
| 250 | + # |
| 251 | + # V11.8.89 in |
| 252 | + # '/nix/store/rsjxr5b5zifa0wbpziwqfzg7lncfz0f0-cuda_cudart-11.8.89/include' |
| 253 | + # and |
| 254 | + # |
| 255 | + # V11.8.89 in |
| 256 | + # '/nix/store/rsjxr5b5zifa0wbpziwqfzg7lncfz0f0-cuda_cudart-11.8.89/include;/nix/store/nljxvgbp6fy0q7cbrp5l5igv57p5fa3v-cuda_nvcc-11.8.89/include;/nix/store/mfk63jcw2r77asgai82rzbzbph10dhh8-cuda_cccl-11.8.89/include;/nix/store/0xhbghrnf7x289m78c8ha2dm6n83wfbg-cuda_cupti-11.8.87/include;/nix/store/4x7gb192a6pskj2skwn9s3m0vnn73bff-cuda_nvml_dev-11.8.86/include;/nix/store/00p0i6kqw6qjbrc4fddqfnv07zcg7gi1-cuda_nvrtc-11.8.89/include;/nix/store/953p97p0inb7wdj50qcz47dy3lh58vhq-cuda_nvtx-11.8.86/include;/nix/store/qsm8bjydfnapr77wzlyzyzcsnkc0yrh2-libcublas-11.11.3.6/include;/nix/store/fszipvg6jw9dsj2lz1izwy7363mwh4fj-libcufft-10.9.0.58/include;/nix/store/8r9kj0rh0kk9iqi32kkm1bdxqb8jipbr-libcurand-10.3.0.86/include;/nix/store/f0d08h7g4apgngbyrgqvpjxmlp3azf0m-libcusolver-11.4.1.48/include;/nix/store/141gw8r2ypg27186mzg81rhndl402l80-libcusparse-11.7.5.86/include;/nix/store/z5ppzlnw5wzy5bbvhm76kfmjmirpkqhb-cuda_profiler_api-11.8.86/include' |
| 257 | + buildInputs = lists.optionals useCuda (with cudaPackages; |
| 258 | + [ |
| 259 | + (lib.getDev nccl) |
| 260 | + cuda_cccl # <thrust/*> |
| 261 | + cuda_cupti |
| 262 | + cuda_nvml_dev # <nvml.h> |
| 263 | + cuda_nvrtc |
| 264 | + cuda_nvtx # -llibNVToolsExt |
| 265 | + libcublas |
| 266 | + libcufft |
| 267 | + libcurand |
| 268 | + libcusolver |
| 269 | + libcusparse |
| 270 | + nccl |
| 271 | + ] |
| 272 | + ++ lists.optionals useCudnn [cudnn] |
| 273 | + ++ lists.optionals (strings.versionOlder cudaVersion "11.8") [ |
| 274 | + cuda_nvprof # <cuda_profiler_api.h> |
| 275 | + ] |
| 276 | + ++ lists.optionals (strings.versionAtLeast cudaVersion "11.8") [ |
| 277 | + cuda_profiler_api # <cuda_profiler_api.h> |
| 278 | + ]); |
| 279 | + |
260 | 280 | cmakeFlags = |
261 | 281 | # Core configuration options |
262 | 282 | [ |
263 | 283 | "-DATEN_NO_TEST:BOOL=ON" |
264 | 284 | "-DBUILD_PYTHON:BOOL=OFF" |
265 | 285 | "-DBUILD_SHARED_LIBS:BOOL=ON" |
266 | 286 | "-DCMAKE_BUILD_TYPE:STRING=Release" |
| 287 | + "-DCMAKE_C_STANDARD:STRING=17" |
| 288 | + "-DCMAKE_CXX_STANDARD:STRING=17" |
267 | 289 | "-DUSE_PRECOMPILED_HEADERS:BOOL=ON" |
268 | 290 | ] |
269 | 291 | # Core dependencies |
|
279 | 301 | "-DUSE_SYSTEM_FMT:BOOL=ON" |
280 | 302 | "-DUSE_SYSTEM_FP16:BOOL=ON" |
281 | 303 | "-DUSE_SYSTEM_FXDIV:BOOL=ON" |
| 304 | + "-DUSE_SYSTEM_ONNX:BOOL=ON" |
282 | 305 | "-DUSE_SYSTEM_PSIMD:BOOL=ON" |
283 | 306 | "-DUSE_SYSTEM_PTHREADPOOL:BOOL=ON" |
284 | 307 | "-DUSE_SYSTEM_PYBIND11:BOOL=ON" |
|
0 commit comments