Software Archive
Read-only legacy content
17061 Discussions

offload error: buffer write failed (error code 6)

mohamad_a_
Beginner
820 Views

Dear all,

I have some pointers to double and some constant values inside a function.

I am using a "#pragma omp target map(tofrom: everypointer[0:size of its corresponding array] ..." to transfer those data to MIC.

The amount of data is not large.(1 MB)

Running the code, I have the following error:

offload error: buffer write failed (error code 6)

Any idea?

 

 

 

0 Kudos
3 Replies
Kevin_D_Intel
Employee
820 Views

Guidance from others was one possible guess is the constants and perhaps them being transferred with the default tofrom and thus attempting to write into read-only host memory for the constant. If you are using a constant inside the offload region then make sure you add it to the clause as map(to…) to override the tofrom default.

If that is not applicable or does not help, then please provide more actual source context. It is best if you can provide a reproducer that we can investigate with ourselves.

0 Kudos
mohamad_a_
Beginner
820 Views

Thank you very much Kevin,

I tryied the map(to...), but it didn't work.

Myfunction() is a function in a library.h which includes some constants and pointers too. It looks like the following:

void Myfunction(const double reZ, double *fpResult, double *fpVector1)

       {

       some other constants; e.g. const int iM, iNx;

       some other pointers to double; e.g. double *fpV;

       #pragma omp target map(to: reZ, iNx, fpV[0:iM*4], fpVector1[0:iM*4])  map(tofrom: fpResult[0:4*iM])

                  {

                  ...

                   }

        }

The function is called many times inside the library.h.

0 Kudos
mohamad_a_
Beginner
820 Views

Dear Kevin,

The issue was pointer fpVector1. It is a null pointer for some calls inside the library.h.

I made 2 pragmas:

      if (fpVector1!=0) #pragma omp target map(to: reZ, iNx, fpV[0:iM*4], fpVector1[0:iM*4])  map(tofrom: fpResult[0:4*iM])

                               {...}

                       else #pragma omp target map(to: reZ, iNx, fpV[0:iM*4])  map(tofrom: fpResult[0:4*iM])

                               {...}

and the problem was solved.

All the best

0 Kudos
Reply