triSYCL / triSYCL

Generic system-wide modern C++ for heterogeneous platforms with SYCL from Khronos Group
Other
438 stars 98 forks source link

TensorFlow SYCL and triSYCL build system #157

Closed yogeshsinghrbt closed 6 years ago

yogeshsinghrbt commented 6 years ago

Which tensorflow and trisycl version are tested together and can build out of the box. I having trouble building tensorflow ( 1.9) with latest trisycl release.

yogeshsinghrbt commented 6 years ago

Able to build tensorflow with trisycl using a-doumoulakis repo.

keryell commented 6 years ago

Great ! But unfortunately the latest TensorFlow is using more advanced features than the current triSYCL can cope with, so you have to use ComputeCpp, currently the only fully compliant SYCL implementation...

yogeshsinghrbt commented 6 years ago

After building with bosst and opencl. I ran following code: import tensorflow as tf

Creates a graph.

with tf.device('/device:SYCL:0'): a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a') b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='b') c = tf.add(a, b)

Creates a session with allow_soft_placement and log_device_placement set

to True.

sess = tf.Session(config=tf.ConfigProto( allow_soft_placement=True, log_device_placement=True))

Runs the op.

print(sess.run(c))

output with CPU device :[[22. 28.] [49. 64.]] (correct) output with SYCL device: [[2.3509838e-38 2.3509838e-38] [2.3509838e-38 2.3509838e-38]] (incorrect)

Can you please let me know why the output from SYCL device is random and different. I am using nvidia gpu with opencl drivers.

Thanks,

keryell commented 6 years ago

As I said somewhere else, TensorFlow can only work natively on GPU through ComputeCpp because it requires advanced SYCL features not implemented by triSYCL yet. Furthermore I am not sure that nVidia supports OpenCL SPIR which is required by the current SYCL implementations I know. There is a feature of PoCL that ingests OpenCL + SPIR and calls CUDA API + PTX, if you are adventurous, with a stack ComputeCpp/PoCL/CUDA that might work... :-) But anyway, if you have an nVidia GPU, why not using TensorFlow with CUDA directly?

yogeshsinghrbt commented 6 years ago

We want to run tensorflow model on various accelerators. As computecpp is not open source, we are more inclined towards other implementations. We will like to contribute towards gpu support of SYCL. Can you please ellaborate more about the advanced SYCL features.

keryell commented 6 years ago

Your goal seems pretty similar to the one from @airlied and a lot of other people. :-)

I think TensorFlow is using placeholder accessors now which are not implemented yet even on CPU https://github.com/triSYCL/triSYCL/issues/96

Then there will be a lot of issues to fix to have a full-fledged device compiler, such as https://github.com/triSYCL/triSYCL/issues/178 https://github.com/triSYCL/triSYCL/issues/179 https://github.com/triSYCL/triSYCL/issues/146 So it is not a short-term task...

keryell commented 6 years ago

Somehow related to https://github.com/triSYCL/triSYCL/issues/150