I posted this question on the Caffe Users forum and reposting it here for the right group. I am sorry for the churn.
This issue is regarding the testcase GPUMathFunctionsTest/0.TestCopy defined in src/caffe/test/test_math_functions.cpp
In this test case we are creating a new opencl context when we call viennacl::ocl::get_context () at line 272
Below are my observations. Function viennacl::ocl::get_context() is being called twice
1 . The function caffe::device::Init() which is in the src/caffe/device.cpp file
2 . In the test case file src/caffe/test/test_math_functions.cpp:272
There will be two different instances of the static variable viennacl::ocl::backend::initialized_ and it may result in a new context being created. I am seeing this issue with the compiler aarch64-linux-android-g++ (gcc version 4.9). Though not able to reproduce the same issue with the gcc x86 compiler (version 4.8.4)
The issues:
1. Is the x86 compiler having an issue.
2. ViennaCL library declaring a static variable in a header file. (backend.hpp). A design issue.
3. Or is the test case incorrect. In this testcase greentea_copy() calls clEnqueueCopyBuffer() and the context for the cl_mem objects are different than the actual context passed to this OpenCL API. Ideally the context should be obtained using the cl_mem object.
Is my understanding correct? Please correct me if I am wrong.
Regards,
Banger.