Commit Graph

28 Commits

Author SHA1 Message Date
Matt Madison
d401aee1eb cuda.bbclass: inherit cuda-gcc, update CMake support
* Use CXX_FOR_CUDA to determine the compiler to pass to nvcc
* Add support for setting CMAKE_CUDA_ARCHITECTURES based on
  the CUDA_ARCHITECTURES variable

Signed-off-by: Matt Madison <matt@madison.systems>
2021-12-16 10:04:11 -08:00
Matt Madison
33fd88b221 cuda.bbclass: update runtime dependency for tegra-libraries split
Signed-off-by: Matt Madison <matt@madison.systems>
2021-10-18 13:16:21 -07:00
Matt Madison
b9507ceb23 meta: convert to new override syntax
* Ran convert-overrides.py to generate the initial changes
* Manual cleanup afterwards (which was a lot, due to our
  extensive use of overrides).

Signed-off-by: Matt Madison <matt@madison.systems>
2021-08-03 08:27:55 -07:00
Matt Madison
9ef40c7fa0 cuda.bbclass: add compatibility with ccache
Signed-off-by: Matt Madison <matt@madison.systems>
2020-11-26 08:32:46 -08:00
Matt Madison
f25c7bf676 cuda.bbclass, cuda-environment: make nvcc easier to find
Prepend our copy of the CUDA toolkit's bin directory to PATH,
rather than appending, so that build systems that search for
nvcc find our copy first for cross builds.

And for CMake, export CUDACXX to point to our copy of nvcc;
CMake will use that environment variable before looking in
the PATH.

Signed-off-by: Matt Madison <matt@madison.systems>
2020-10-13 05:19:04 -07:00
Matt Madison
0bd00bd4e7 cuda.bbclass, cuda-environment: fix CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES
Fix the quoting used in the cmake toolchain files so that variable references
are interpreted by CMake rather than bitbake, and so that the resultant
value is a list rather than a single space-separated string.

Signed-off-by: Matt Madison <matt@madison.systems>
2020-10-13 05:19:04 -07:00
Matt Madison
241e236548 cuda.bbclass, tegra-libraries: move nvgpu kernel module dependency
The dependency on the GPU driver is really in the libraries
provided by the tegra-libraries package, since it applies to
the libEGL_nvidia library as well as the libcuda library.
So move the RRECOMMENDS on the kernel driver to that package,
and drop it from cuda.bbclass.

Signed-off-by: Matt Madison <matt@madison.systems>
2020-09-03 06:02:05 -07:00
Matt Madison
5777561e6b cuda.bbclass: add support for meson builds
Note that a patch is required for meson 0.55 to
fix an issue with identifying CUDA compiler when
cross-building (see #409).

Signed-off-by: Matt Madison <matt@madison.systems>
2020-09-02 09:52:37 -07:00
Matt Madison
0eb5085402 meta: remove cuda-toolkit from target-side dependencies for CUDA builds
cuda-toolkit includes the compiler and command-line tools, which
should *not* be required on the target; only the cuda-libraries
packages should be needed for building and running CUDA apps.

However, there are assumptions in the CUDA packages about the way
the CUDA SDK is normally packaged - with host and target files
co-located.  In particular, there are host-side header files in
the cuda-nvcc package that need to be available in the target's
include tree so they can be found without explicitly including
the host-side include tree (something that isn't easy to do
when include paths get discovered via pkg-config).

To resolve this, the cuda-nvcc-headers recipe is added, which
packages just the header files from cuda-nvcc.  Appropriate
dependencies are added to ensure that those headers are
available when needed.

Also included here are some variable updates to add in
the host-side includes, and some updates to the SDK
environment, particularly for CMake support, so that
it works properly with the new structure.

Signed-off-by: Matt Madison <matt@madison.systems>
2020-07-27 04:12:06 -07:00
Matt Madison
2b679e9b77 meta: use tegra-cmake-overrides for CUDA builds
- update the settings in cuda.bbclass
- update the toolchain environment for SDK builds

Signed-off-by: Matt Madison <matt@madison.systems>
2020-07-27 04:12:06 -07:00
Matt Madison
1ddbdb7bbf cuda.bbclass, cuda-environment: add some environment variables
for better compatibility with the old FindCUDA module.

Signed-off-by: Matt Madison <matt@madison.systems>
2020-06-03 09:49:57 -07:00
Matt Madison
4cace17f11 cuda.bbclass: update to align with SDK builds
This is mostly cleanup to align with the CUDA language
support that has been in CMake since version 3.8 - setting
the correct environment variables with the correct values
makes CMake's auto-discovery work better, so we can
remove much of the toolchain config file settings that
were there as workarounds.

The settings related to using FindCUDA are kept, for now.

Signed-off-by: Matt Madison <matt@madison.systems>
2020-04-01 08:11:33 -07:00
Matt Madison
66077edf51 cuda.bbclass: use RRECOMMENDS for kernel-module-nvgpu
It is possible to build the nvgpu driver into the kernel,
instead of leaving it as a separate module, so don't cause
build failures in that case.

Signed-off-by: Matt Madison <matt@madison.systems>
2020-03-13 08:27:41 -07:00
Matt Madison
6112c82e9b cuda.bbclass: replace hard-coded 'lib' with ${baselib}
The recipes use ${baselib} when installing the libraries,
so stick with that.

Signed-off-by: Matt Madison <matt@madison.systems>
2020-02-07 04:22:43 -08:00
Leon Anavi
d42699d38a cuda.bbclass: Add kernel-module-nvgpu to RDEPENDS
Add kernel-module-nvgpu to CUDA run-time dependencies. Without
it CUDA 10 is not properly working and CUDA-capable devices are
NOT detected.

Signed-off-by: Leon Anavi <leon.anavi@konsulko.com>
2019-07-18 04:44:10 -07:00
Matt Madison
b07f9f5ad9 cuda.bbclass: add cmake CUDA language support
cmake 3.8 and later have built-in language support for CUDA,
replacing the FindCUDA package finder. Add settings to support
this for Tegra cross-compilation.

[For #83 and #138]

Signed-off-by: Matt Madison <matt@madison.systems>
2019-06-15 11:32:50 -07:00
Matt Madison
1d11f44d23 cuda.bbclass: restructure CUDA_NVCC_FLAGS composition
- rename target-specific flags CUDA_NVCC_ARCH_FLAGS
- add CUDA_NVCC_COMPAT_FLAGS for compiler-compatibility flags
- add CUDA_NVCC_EXTRA_FLAGS for recipes to use where needed

Signed-off-by: Matt Madison <matt@madison.systems>
2017-08-27 11:48:56 -07:00
Matt Madison
a9dc30b7a7 cuda.bbclass: pass CUDA_NVCC_FLAGS to cmake
Signed-off-by: Matt Madison <matt@madison.systems>
2017-08-26 06:20:07 -07:00
Matt Madison
b2ff73e203 cuda.bbclass: use 'cuda' override
for setting variables.  The python expressions previously
used did not interact well with BBCLASSEXTEND, causing
build failures that were difficult to work around.

(Fixes #45)

Signed-off-by: Matt Madison <matt@madison.systems>
2017-08-26 06:20:07 -07:00
Matt Madison
95816a0a5c cuda.bbclass: updates for cuda toolkit repackaging
Signed-off-by: Matt Madison <matt@madison.systems>
2017-08-26 06:20:07 -07:00
Matt Madison
dbe6946246 cuda.bbclass: add missing override for tegra186
and switch the PACKAGE_ARCH to SOC_FAMILY_PKGARCH.

Signed-off-by: Matt Madison <matt@madison.systems>
2017-08-26 06:20:07 -07:00
Matt Madison
62d8221a9b cuda.bbclass: add cmake definitions
to prevent FindCUDA.cmake from trying to locate
the CUDA toolkit by itself.

[ For #30 ]

Signed-off-by: Matt Madison <matt@madison.systems>
2017-06-03 11:19:39 -07:00
Matt Madison
854e595650 cuda.bbclass: add definitions to cmake toolchain file
To work around this cmake 3.7 issue:
https://gitlab.kitware.com/cmake/cmake/issues/16509

Signed-off-by: Matt Madison <matt@madison.systems>
2017-02-05 06:29:31 -08:00
Matt Madison
5205bc32d4 cuda.bbclass: eliminate anonymous python function
and just use bb.utils.contains in variable settings.
And switch back to using a machine override for setting
PACKAGE_ARCH, since doing that via the conditional is
proving to be problematic in some cases.

Signed-off-by: Matt Madison <matt@madison.systems>
2017-01-20 11:38:49 -08:00
Jack Mitchell
bec215d8ad cuda.bbclass: only add CUDA flags when cuda in MACHINE_FEATURES 2016-12-06 03:47:21 -08:00
Matt Madison
ecc5cd59af cuda.bbclass: add overrides for tegra124 SOCs
Signed-off-by: Matt Madison <matt@madison.systems>
2016-10-29 11:32:30 -07:00
Matt Madison
13e81f3594 cuda.bbclass: use SOC-specific overrides
so that builds for non-CUDA platforms don't get confused.

Signed-off-by: Matt Madison <matt@madison.systems>
2016-10-28 07:58:49 -07:00
Matt Madison
a25dbcc886 cuda.bbclass: add bbclass for CUDA support
Signed-off-by: Matt Madison <matt@madison.systems>
2016-10-04 14:08:36 -07:00