Hi everyone,

I'm quite a beginer and am having some trouble with my OpenCL C code :

Code :
struct knapSack
{
    int valeur;
    int dimension;
};
typedef struct knapSack knapSack;
 
 
__kernel void knapSack_kernel(__read_only int *tableauObjet, __global int *F, __read_only int capaciteMaxSac, __read_only int nbElement, __global int *resultat)
{
    int E = 0;
    int i = nbElement;
 
    for( E = 0; E <= capaciteMaxSac ; E++)
    {
        if(( E <=( capaciteMaxSac - tableauObjet[nbElement - 1]->dimension)) && (tableauObjet[nbElement - 1]->valeur >= 0))
        {
            F[E] = tableauObjet[nbElement - 1]->valeur;
        }
        else
        {
            F[E] = 0;
        }
    }
    i--;
 
 
    while(i > 1)
    {
        for(E = 0; E <= capaciteMaxSac; E++)
        {
            if( E + tableauObjet[i-1]->dimension > capaciteMaxSac)
            {
 
            }
            else
            {
                F[E] = fmax(F[E], tableauObjet[i - 1]->valeur + F[E + (int)tableauObjet[i - 1]->dimension]);
            }
        }
        i--;
 
 
    }
 
    F[0] = fmax(F[0],tableauObjet[0]->valeur+F[(int)tableauObjet[0]->dimension]);
    resultat = (int)F[0];
 
}


I get the following errors:

Code :
 :9:47: error: invalid address space for pointee of pointer argument to __kernel function
__kernel void knapSack_kernel(__read_only int *tableauObjet, __global int *F, __read_only int capaciteMaxSac, __read_only int nbElement, __global int *resultat)
                                              ^
:16:66: error: member reference type 'int' is not a pointer
        if(( E <=( capaciteMaxSac - tableauObjet[nbElement - 1]->dimension)) && (tableauObjet[nbElement - 1]->valeur >= 0))
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^
:18:49: error: member reference type 'int' is not a pointer
            F[E] = tableauObjet[nbElement - 1]->valeur;
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^
:36:40: error: member reference type 'int' is not a pointer
            if( E + tableauObjet[i-1]->dimension > capaciteMaxSac)
                    ~~~~~~~~~~~~~~~~~  ^
:42:56: error: member reference type 'int' is not a pointer
                F[E] = fmax(F[E], tableauObjet[i - 1]->valeur + F[E + (int)tableauObjet[i - 1]->dimension]);
                                  ~~~~~~~~~~~~~~~~~~~  ^
:51:39: error: member reference type 'int' is not a pointer
    F[0] = fmax(F[0],tableauObjet[0]->valeur+F[(int)tableauObjet[0]->dimension]);
                     ~~~~~~~~~~~~~~~  ^
:52:14: warning: incompatible integer to pointer conversion assigning to 'int __attribute__((address_space(1))) *' from 'int'
    resultat = (int)F[0];
             ^ ~~~~~~~~~
I do understand the errors, but don't have any idea how to solve them. It must be very simple but, as I said, I'm quite a newbie.

If someone could give me a hint how to solve them, it would be great.

I thank you beforehand for your answers;

Regards;

Elrachal