Software Archive
Read-only legacy content

Offload Transfer Speed

Chen__Xin
Beginner
417 Views

I conducted a experiemt to test data transfer speed

#pragma offload target(mic) out(outImage:length(width*height) alloc_if(1) free_if(1)) in(img1,img2:length(width*height) alloc_if(1) free_if(1))
        {
          //int a = 0;
          //omp_set_num_threads(192);
          //const size_t iCPUNum = omp_get_max_threads();
          //printf("Get number = %d\n", iCPUNum);
          //fflush(0);
          const unsigned int  ySegment = height/iCPUNum;
#pragma omp parallel for
          for (unsigned int  n = 0; n < iCPUNum; n++)
            {
              const unsigned int  starty = n * width;
              unsigned int endy = starty + ySegment;
              if(n = (iCPUNum -1))  endy = height;
              unsigned char  tmpArray1[width];
              unsigned char  tmpArray2[width];
              unsigned char  tmpArrayout[width];

              for (size_t y = starty; y < endy; y++)
                {
                  memcpy(tmpArray1, &img1[y*width], width*sizeof(char));
                  memcpy(tmpArray2, &img2[y*width], width*sizeof(char));
                  for (unsigned int  nn = 0; nn < LOOPNUM; nn++)
                    {
                      for (unsigned int  x = 0; x < width; x++)
                        {
                          tmpArrayout[ x] = tmpArray1*0.5f + tmpArray2*0.5f;
                        }
                    }
                  memcpy( &outImage[y*width], tmpArrayout,width*sizeof(char));

                }
            }//end of n<iCPUNum
        }//end of pragma

 

[Offload] [MIC 0] [File]            imageAdd.cpp
[Offload] [MIC 0] [Line]            144
[Offload] [MIC 0] [Tag]             Tag 2
[Offload] [HOST]  [Tag 2] [CPU Time]        0.946899(seconds)
[Offload] [MIC 0] [Tag 2] [CPU->MIC Data]   18874384 (bytes)
[Offload] [MIC 0] [Tag 2] [MIC Time]        0.856914(seconds)
[Offload] [MIC 0] [Tag 2] [MIC->CPU Data]   9437200 (bytes)

 

the transfer time is t = 0.94899-0.856914 = 0.089985. Data transfer speed ~= 300 M per sec. It sounds the value is far lower that the value mentioned in some documents. Could you tell me why?

 

Thanks  a lot!

Xin

 

0 Kudos
2 Replies
Sunny_G_Intel
Employee
417 Views

Hello Xin,

Can you please provide a test program we can use to reproduce your problem. Also there might be some MIC initialization times affecting your analysis. Do you get the same results on multiple iterations of the chunk of code you are trying to run or the behavior is only for the first iteration.

You can also send me a private message in case you don't want to publicly share your test program. 

 

0 Kudos
Sunny_G_Intel
Employee
417 Views

Hello Xin,

I would like to follow up on the issue about offload transfer speed you reported. I hope you were able to resolve the issue.

Regards,

Sunny

0 Kudos
Reply