Git Product home page Git Product logo

Comments (7)

AndrewSivrit avatar AndrewSivrit commented on September 14, 2024

If run to train speed of learning is slow down too

from darknet-on-opencl.

 avatar commented on September 14, 2024

The performance of CL is lower than corresponding CUDA implementation on the same device.
@ganyc717 @AndrewSivrit
I want to known that whether the code supports train yolo2 on multiple CL devices?

from darknet-on-opencl.

ganyc717 avatar ganyc717 commented on September 14, 2024

Hi @Kylin-PHYTIUM
I have checked the bottleneck, the performance blocked at BLAS library, I think nvidia has their own well optimization cuBLAS library which is about 3 times faster than clBLAS.
Currently multi device is not supported, maybe I will add support later.

from darknet-on-opencl.

Bardo91 avatar Bardo91 commented on September 14, 2024

The same issue happens to me. When I let it run for a while, the speed starts decreasing. Here I plot the times in microseconds over time for some of the required stages. All of them remain stable (img preparation, data copy, result copying etc...) but the prediction grows continuously.
image

To be exact, the call that grows in time is the call to the prediction of the net from the data, i.e. network_predict(net, X);.

Any clue?

from darknet-on-opencl.

Bardo91 avatar Bardo91 commented on September 14, 2024

Just to isolate the problem I observed what happens if I reload the "network *net" object each time I use it. Basically I call net = load_network(wStr1, wStr2, 0); at the beginning of the loop and free_network(net); at the end. It can be clearly seen in the following figure that the "slow down" does not happens if the network is reloaded:
image

Left figure shows that if the net is not reloaded, i.e. it is loaded just at the beginning (which is the logical behaviour), then the prediction time increases. However, right figure shows that if the net is reloaded each time, then no slow down can be observed, but obviously, loading the network takes a couple of seconds, so it is not a solution...
I will keep digging into the problem, I hope this helps to someone else too.

from darknet-on-opencl.

Bardo91 avatar Bardo91 commented on September 14, 2024

I am not an expert in neither YOLO nor CL, but while debugging a bit the code I found that the code that slows down over time is https://github.com/ganyc717/Darknet-On-OpenCL/blob/master/darknet_cl/src/network.cpp#L781. Particularly, using tiny_yolo_v2, the layer that causes the issue is the layer number 15, which seems to be the region_layer.... The deeper I went was this line

cl_int status = clEnqueueNDRangeKernel(*cl->queue, kernel, 3, NULL, global_size, NULL, NULL, NULL, &e);
. If I am not wrong, that line queue the call of the kernel, what can cause that continuous increment of time?

from darknet-on-opencl.

Bardo91 avatar Bardo91 commented on September 14, 2024

I modified the code to enable CL_QUEUE_PROFILING_ENABLE. Then I added the following lines to profile the enqueue call:

cl_ulong time_start;
cl_ulong time_end;
clGetEventProfilingInfo(e, CL_PROFILING_COMMAND_START, sizeof(time_start), &time_start, NULL);
clGetEventProfilingInfo(e, CL_PROFILING_COMMAND_END, sizeof(time_end), &time_end, NULL);
double nanoSeconds = time_end-time_start;
printf("OpenCl Execution time is: %0.3f milliseconds \n",nanoSeconds / 1000000.0);

These measures of time remain stable... which confuses me more. It seems that the GPU run it self takes the same time, but when the measure of the cpu call it grows in time:

clock_t t1 = clock();
cl_event e;
cl_int status = clEnqueueNDRangeKernel(*cl->queue, kernel, 3, NULL, global_size, NULL, NULL, NULL, &e);
clock_t t2 = clock();
printf("enqueue : \t %f\n",(float)(t2 - t1) / CLOCKS_PER_SEC);

from darknet-on-opencl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.