MenkaMore
MenkaMore

Reputation: 37

Can we use structure of structure in opencl?

I'm using structure as follows.

struct domain_data
{
     int *no_h_domains,
     *no_v_domains,
     *domain_hsize,
     *domain_vsize,
     *domain_hstep,
     *domain_vstep;
     struct domain_pixels
     {
          int dom_x, dom_y;
          double sum,sum2;
          int sym;
     } ***pixel;

} domain;

But when I try

domain.pixel= (struct domain_pixels ***) malloc(i*sizeof(struct domain_pixels **));

then it gives following errors.

error C2440: '=' : cannot convert from 'domain_pixels ' to 'domain_data::domain_pixels'

and

a value of type "domain_pixels *" cannot be assigned to an entity of type "domain_data::domain_pixels *"

But the same code is executed perfectly fine in win32 application.

Can anyone tell me, whether I can do this in opencl? if yes then how?

Upvotes: 1

Views: 139

Answers (3)

MenkaMore
MenkaMore

Reputation: 37

When I created another OpenCl project and copied same code over there, then that error is removed ! So thanks everyone for their reply!

Upvotes: 0

DarkZeros
DarkZeros

Reputation: 8420

The problem is not in the structure of structure, the problem is in the pointers and triple pointers of your struct.

No pointers are allowed to be passed in OpenCL. Even without that it will never work, since malloc is not allowed in OpenCL.

Please read a guide and a tutorial, before trying to copy-paste a monster C code expecting it to work directly.

Upvotes: 1

Elalfer
Elalfer

Reputation: 5358

It should be doable using OpenCL 2.0 & SVM with Fine-Grain buffers. Intel is planning to start SVM support with BDW.

Upvotes: 0

Related Questions