Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bolt1.2: std::partial sum is having compilation issues when we used with UDD by calling transform_iterator. #214

Open
jhkumar opened this issue Jul 2, 2014 · 0 comments

Comments

@jhkumar
Copy link

jhkumar commented Jul 2, 2014

CODE:

int get_global_id(int i);

int global_id;

BOLT_FUNCTOR(UDD_trans,
struct UDD_trans
{
int i ;
float f ;

UDD_trans ()  
    {
    }; 

UDD_trans (int val1)  
    {
        i =  val1 ;

    }; 
bool operator == (const UDD_trans& other) const {
    return ((i+f) == (other.i+other.f));
}

UDD_trans operator() ()  const 
    { 
        UDD_trans temp ;
        temp.i =  get_global_id(0);
        return temp ;
        //return get_global_id(0); 
    }

};
);

int get_global_id(int i)
{
return global_id++;
}

BOLT_FUNCTOR(add_UDD,
struct add_UDD
{
int operator() (const UDD_trans x) const { return x.i + 3; }
typedef int result_type;
};
);

BOLT_TEMPLATE_REGISTER_NEW_ITERATOR( bolt::cl::device_vector, int, UDD_trans);
BOLT_TEMPLATE_REGISTER_NEW_TRANSFORM_ITERATOR( bolt::cl::transform_iterator, add_UDD, UDD_trans);

int main()
{

int length =  5;

std::vector< UDD_trans > svInVec1( length ); 

std::vector< int > stlOut(length);

add_UDD add1;
UDD_trans gen_udd(0) ;


// ADD
bolt::cl::transform_iterator< add_UDD, std::vector< UDD_trans >::const_iterator>        sv_trf_begin1 (svInVec1.begin(), add1) ;
bolt::cl::transform_iterator< add_UDD, std::vector< UDD_trans >::const_iterator>            sv_trf_end1   (svInVec1.end(),   add1) ;

    global_id = 0;
std::generate(svInVec1.begin(), svInVec1.end(), gen_udd);

        bolt::cl::plus<int> pls;

        bolt::cl::control ctrl = bolt::cl::control::getDefault();

    global_id = 0;

 //STD_PARTIAL_SUM
std::partial_sum(sv_trf_begin1, sv_trf_end1, stlOut.begin(), pls);

for (int i=0; i<length;  i++ )
{
    std::cout << "Val = "  << stlOut[i] <<  "\n" ;

}

return 0;
}

@jhkumar jhkumar changed the title Bolt_1.2:-Windows 32 & 64 bit: std::partial sum is having compilation issues when we used with UDD by calling transform_iterator. std::partial sum is having compilation issues when we used with UDD by calling transform_iterator. Jul 2, 2014
@jhkumar jhkumar changed the title std::partial sum is having compilation issues when we used with UDD by calling transform_iterator. Bolt1.2: std::partial sum is having compilation issues when we used with UDD by calling transform_iterator. Jul 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant