Wind-River / meta-tensorflow

Other
13 stars 18 forks source link

Build for GPU rather than CPU #2

Open jhfortemtech opened 5 years ago

jhfortemtech commented 5 years ago

Thanks for creating these recipes! Got meta-tensorflow to build with yocto warrior and run on the CPU. What needs to be done to build for a GPU (such as CUDA 10)?

hongxu-jia commented 5 years ago

I did not try GPU, but in recipe tensorflow, we have var-TF_CONFIG: ... TF_CONFIG ?= " \ TF_NEED_CUDA=0 \ TF_NEED_OPENCL_SYCL=0 \ TF_NEED_OPENCL=0 \ TF_CUDA_CLANG=0 \ TF_DOWNLOAD_CLANG=0 \ TF_ENABLE_XLA=0 \ TF_NEED_MPI=0 \ TF_SET_ANDROID_WORKSPACE=0 \ " ... Would you please re-assign it with TF_NEED_CUDA=1 or anything you require

hongxu-jia commented 5 years ago

I am not sure about the cuda support on cross compiling, I suggest you to have a try on tensorflow-native recipe if the host support cuda, manually set s/TF_NEED_CUDA=0/TF_NEED_CUDA=1/

But I think it still require extra cuda packages, such as https://github.com/tensorflow/tensorflow/issues/4827

paroque28 commented 4 years ago

Hi @hongxu-jia I have been working on enabling TensorFlow with GPU. The most important thing is needed is getting the Crosstool wrapper for compiling CUDA programs: https://github.com/tensorflow/tensorflow/blob/v1.13.0-rc2/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl

I am still working on it but I would thank any help getting Bazel working on with the yocto_compiler_configure.bzl. We need to change Windriver's GCC compiler for the wrapper that detects CUDA.

I have already been able to add the PACKAGECONFIG[cuda] and all the necessary flags and configs to enable the right do_configure.

PD: CUDA is available through meta-tegra.

Regards, Pablo