1 Reply Latest reply on Jul 23, 2008 9:29 AM by Remotion

    why is CPU usage high while GPU do the most work?


      Hi, all,

      I has write a simple kernel to do memcopy and loop to call the kernel 500 times to test GPU copy speed. but when the code is running ,I found the cpu usage is so high(50%, my cpu is dual core).

      As my understanding, the kernel will run on the GPU, and CPU has seldom work to do except for controlling the loop, so the CPU usage should be low, Am I right? or is there anything wrong with my code? Can someone help me about it? Thank you!

      my code is as below:

      kernel void kernel_brookcopy(float4 input<>, out float4 output<>


      output = input;


      the caller of the kernel is:

      float4 in<480, 720>;

      float4 out<480,720>;

      int iteration = 500;

      int i = 0;

      for(i=0; i


      kernel_brookcopy(in, out);




        • why is CPU usage high while GPU do the most work?Hi,


          you code is correct but it does not measure GPU copy speed.

          In you test GPU has almost nothing to do the only time consuming part is on CPU site this is calling kernel_brookcopy(in, out); 500 times.

          You can try to move this loop into kernel and call only once.

          kernel void loop(float4 input<>, out float4 output<>, float itr)
              float i;
              for(i=0; i<itr; ++i) output = input + i;


          Remember that this simple test will NOZ proveide yo with some useful information about GPU speed.

          Please look at optimized_matmult sample.