CTranslate2 icon indicating copy to clipboard operation
CTranslate2 copied to clipboard

Facing issues with Ctranslate2 when working with Intel built-in GPU and oneDNN

Open prasad-pr-20 opened this issue 8 months ago • 5 comments

HI All,

I'm trying to build CTranslate2 with oneDNN support enabled which internally uses the Intel GPU. When I execute the benchmark tests, I don't see any output, when gpu is enabled.

When I run the oneDNN examples, I observe that the GPU is enabled, which is not observable in the case of CTranslate2.

Thanks in advance for your suggestions and help. Below are the steps to replicate and system configuration.

Below is the my system configuration:

Operating System: windows 11 Intel Processor: Intel 12th gen i9 Intel graphics: Intel UHD Graphics 770 driver.

Steps to replicate:

  1. Enable oneapi environment "C:\Program Files (x86)\intel\oneAPI\setvars.bat"
  2. git clone https://github.com/oneapi-src/oneDNN.git
  3. cmake -DCMAKE_BUILD_TYPE=Release -DONEDNN_BUILD_TESTS=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx -G Ninja ..
  4. cmake --build . --config Release --target install --parallel 8
  5. git clone --recursive https://github.com/OpenNMT/CTranslate2.git
  6. set CTRANSLATE2_ROOT=Path to ctranslate2_dir
  7. mkdir build && cd build
  8. cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="C:\Program Files (x86)\oneDNN" -DCMAKE_INSTALL_PREFIX=%CTRANSLATE2_ROOT% -DWITH_DNNL=ON ..
  9. cmake --build . --config Release --target install --parallel 8
  10. Copy the .dlls to build\tests\Release\
  11. set ONEDNN_VERBOSE=1
  12. set CT2_VERBOSE=1
  13. set CT2_WITH_DNNL=1

Then upon running the benchmark_ops.exe conv1d cpu fp32. I get the below output. cpu_log_with configuration

Now to see if GPU is being used, I modify the source code at

https://github.com/OpenNMT/CTranslate2/blob/3b248f135d53fc21972c3321d0a0d3119392baed/src/ops/conv1d_cpu.cc#L17

changing the engine from cpu to gpu. And build using the same commands earlier.

Expectation was the observe some outputs as above with gpu as the engine, but all I see is system configuration and nothing much as below: ct2_with_gpu

Is this an expected output or can anyone guide me as to what might have gone wrong.

prasad-pr-20 avatar May 28 '24 14:05 prasad-pr-20