@@ -1136,3 +1136,101 @@ key with ``docker_image``. Also ``cdt_name`` ensures the CDTs match the CentOS
1136
1136
version. If this changes in the future, then this extra key may not be needed.
1137
1137
1138
1138
Finally, note that the ``aarch64 `` and ``ppc64le `` platforms already use CentOS 7.
1139
+
1140
+ .. _cuda :
1141
+
1142
+ CUDA builds
1143
+ ===========
1144
+
1145
+ Although the provisioned CI machines do not feature a GPU, Conda Forge does provide mechanisms
1146
+ to build CUDA-enabled packages. These mechanisms involve several packages:
1147
+
1148
+ * ``cudatoolkit ``: The runtime libraries for the CUDA toolkit. This is what end-users will end
1149
+ up installing next to your package.
1150
+
1151
+ * ``nvcc ``: Nvidia's EULA does not allow the redistribution of compilers and drivers. Instead, we
1152
+ provide a wrapper package that locates the CUDA installation in the system. The main role of this
1153
+ package is to set some environment variables (``CUDA_HOME ``, as well as ``CFLAGS `` and friends),
1154
+ as well as wrapping the real ``nvcc `` executable to set some extra command line arguments.
1155
+
1156
+ .. note ::
1157
+
1158
+ **How is CUDA provided at the system level? **
1159
+
1160
+ * On Linux, Nvidia provides official Docker images, which we then
1161
+ `adapt <https://github.com/conda-forge/docker-images >`_ to the Conda Forge needs.
1162
+
1163
+ * On Windows, the compilers need to be installed for every CI run. This is done through the
1164
+ `conda-forge-ci-setup <https://github.com/conda-forge/conda-forge-ci-setup-feedstock/ >`_ scripts.
1165
+ Do note that the Nvidia executable won't install the drivers because no GPU is present in the machine.
1166
+
1167
+ In practice, to enable CUDA on your package, add ``{{ compiler('cuda') }} `` to the ``build ``
1168
+ section of your requirements. The matching ``cudatoolkit `` will be added to the ``run ``
1169
+ requirements automatically.
1170
+
1171
+ Testing the packages
1172
+ --------------------
1173
+
1174
+ Since the CI machines do not feature a GPU, you won't be able to test the built packages as part
1175
+ of the conda recipe. For now, the workaround is to enable the Azure artifacts for your feedstock
1176
+ (see :ref: `azure-config `) and then perform the tests locally.
1177
+
1178
+ Common problems and known issues
1179
+ --------------------------------
1180
+
1181
+ Helping your build system locate CUDA
1182
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1183
+
1184
+ Some build systems might need some help finding CUDA, so you might need to pass the value
1185
+ of ``CUDA_HOME `` as some kind of flag. Some examples include:
1186
+
1187
+ * Old-style CMake (using the deprecated ``FindCUDA `` module), you might need to pass this flag::
1188
+
1189
+ -DCUDA_TOOLKIT_ROOT_DIR=${CUDA_HOME}
1190
+
1191
+ * On Windows, if you need to pass ``CUDA_PATH ``, CMake might choke on a backslash. In that case,
1192
+ you can overwrite ``CUDA_PATH `` as follows::
1193
+
1194
+ set "CUDA_PATH=%CUDA_PATH:\=/%"
1195
+
1196
+ * On Windows packages that are built with MSBuild, new-style CMake (using ``FindCUDAToolkit `` module)
1197
+ you might need to define this environment variable::
1198
+
1199
+ set "CudaToolkitDir=%CUDA_PATH%"
1200
+
1201
+
1202
+ CUDA 11 and CDT packages
1203
+ ^^^^^^^^^^^^^^^^^^^^^^^^
1204
+ If your package requires both CUDA and some CDTs on Linux, you will need to patch the
1205
+ ``.ci_support/*.yml `` files corresponding to CUDA 11 and above so they reflect
1206
+ ``cdt_name: cos7 ``. Do note that these changes do not survive feedstock rerenders!
1207
+
1208
+ This should be fixed at some point, but for now you need to do it manually. Apologies!
1209
+
1210
+
1211
+ Adding support for a new CUDA version
1212
+ -------------------------------------
1213
+
1214
+ Providing a new CUDA version involves five repositores:
1215
+
1216
+ * `cudatoolkit-feedstock <https://github.com/conda-forge/cudatoolkit-feedstock >`_
1217
+ * `nvcc-feedstock <https://github.com/conda-forge/nvcc-feedstock >`_
1218
+ * `conda-forge-pinning-feedstock <https://github.com/conda-forge/conda-forge-pinning-feedstock >`_
1219
+ * `docker-images <https://github.com/conda-forge/docker-images >`_ (Linux only)
1220
+ * `conda-forge-ci-setup-feedstock <https://github.com/conda-forge/conda-forge-ci-setup-feedstock >`_ (Windows only)
1221
+
1222
+ The steps involved are, roughly:
1223
+
1224
+ 1. Add the ``cudatoolkit `` packages in ``cudatoolkit-feedstock ``
1225
+ 2. Submit the version migrator to ``conda-forge-pinning-feedstock ``.
1226
+ This will stay open during the following steps.
1227
+ 3. For Linux, add the corresponding Docker images at ``docker-images ``.
1228
+ Copy the migration file manually to ``.ci_support/migrations ``.
1229
+ This copy should not specify a timestamp. Comment it out and rerender.
1230
+ 4. For Windows, add the installer URLs and hashes to the ``conda-forge-ci-setup ``
1231
+ `script <https://github.com/conda-forge/conda-forge-ci-setup-feedstock/blob/master/recipe/install_cuda.bat >`_.
1232
+ The migration file must also be manually copied here. Rerender.
1233
+ 5. Create the new ``nvcc `` packages for the new version. Again, manual
1234
+ migration must be added. Rerender.
1235
+ 6. When everything else has been merged and testing has taken place,
1236
+ consider merging the PR opened at step 2 now so it can apply to all the downstream feedstocks.
0 commit comments