Reply to comment

Очень медленное копирование из Amd HD3870 в ОЗУ

Использую CAL API
Копирую массивчики векторов по 4 элемента типа float: ширина=8192, высота=1024.
Скорость =50Мб/сек
Если из цикла убрать собственно копирование(помечено комментами), то время исполнения
голого цикла уменьшается в 11 раз. Т.е. На этих 4 строчках быстродействие падает в 11 раз.
Аналогичная функция для записи в ГПУ честно работает на скорости 450Мб/сек.
Вопрос: "Что делать"?
Процесс примерно такой:

  1. ...
  2. float* fdata =NULL;
  3. CALuint pitch =0;
  4. calResMap((CALvoid**)&fdata, &pitch, resource, 0);
  5. ...
  6. int s_idx =0;
  7. int d_idx =0;
  8. for (int currHeight = 0; currHeight < height; ++currHeight)
  9. {
  10. for (int currWidth = 0; currWidth <width; ++currWidth)
  11. {
  12.  
  13.         int currDstCompCount =0;
  14.         if((Component::x &dstComp) !=0)
  15.         {
  16.                 dst[d_idx] =fdata[s_idx];//если убрать это, то скорость вырастает
  17.                 currDstCompCount++;
  18.         }
  19.         if((Component::y &dstComp) !=0)
  20.         {
  21.                 dst[d_idx +currDstCompCount] =fdata[s_idx +1];//если убрать это, то скорость вырастает
  22.                 currDstCompCount++;
  23.         }
  24.         if((Component::z &dstComp) !=0)
  25.         {
  26.                 dst[d_idx +currDstCompCount] =fdata[s_idx +2];//если убрать это, то скорость вырастает
  27.                 currDstCompCount++;
  28.         }
  29.         if((Component::w &dstComp) !=0)
  30.         {
  31.                 dst[d_idx +currDstCompCount] =fdata[s_idx +3];//если убрать это, то скорость вырастает
  32.         }
  33.         d_idx +=dstCompCount;
  34.         s_idx +=compCount;
  35. }
  36. s_idx += (pitch *compCount) -(width *compCount);
  37. }
  38. ...
  39. calResUnmap(resource);
  40. ...

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <i> <table> <td> <tr> <th>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo].
  • Images can be added to this post.

More information about formatting options

Copyright © 2008-2011 Alex Tutubalin