-
Notifications
You must be signed in to change notification settings - Fork 336
Problem using arbitrary struct as value parameter in compute::sort_by_key() #162
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
Comments
Hi Jesko, This should be possible. However, you will have to use the Let me know if you run into any issues. Cheers, |
@jesko42 I assume this is working for you. Please re-open if you are still having issues. |
Hi Kyle, if(sort_by_key){
options << " -DSORT_BY_KEY";
if( is_fundamental<T2>::value )
options << " -DT2=" << type_name<T2>();
else
options << " -DT2=\"struct " << type_name<T2>() << "\"";
} /jay |
Hmm, could you provide a small, compilable test-case/example which demonstrates the problem? This will help in tracking down the bug and getting it fixed. Thanks, |
Ok, this is strange. I tried to write a little example but was not able to reproduce the error. I will now try to distill my program down. I think the problem might be that I use a self-written wrapper for OpenCL and CUDA and use boost::compute only for algorithms like sort and scan. But maybe the build log for the sort might give you an idea whats wrong.
|
Hmm, it seems like it's not picking up the definition for the And thanks, having a small example test-case that we can add to the unit tests would be very helpful in fixing this and ensuring it continues to work correctly in the future. Thanks! |
Ok, I got it! The problem really seems to be that I create all the OpenCL stuff myself. Here is the code that produces the error:
|
Hi Kyle! Quick question, are you working on this or should I try to fix this one myself? |
I haven't had much time to work on this in the past week. If you have a fix I'd be very interested in getting it merged in (instructions for submitting pull-requests can be found in the developers guide on the wiki). Also, it would be good to have a small test case for this issue which could be added to the |
Ok, I will try my best. The current hacked "fix" is just the above mentioned inclusion of the structs definition in the source code for the radix sort. So now I'll try to get to the root of this. |
Ok, I don't know why, but even the following code does not work for me (crashes with the aforementioned error). Can you confirm this?
|
Yeah, that crashes for me too (fails to compile the OpenCL program). This is probably caused by the radix sort program using custom built program with its source as a raw string instead of using the |
Thanks, that would be awesome! Unfortunately I don't have much time at the moment due to some upcoming exams. |
Hi there, did you make any progress regarding this issue? Now I have to get some timings of my program and it would be nice to be able to use OpenCL for the sorting there. |
Sorry, haven't made much progress on this. I've been busy with the peer-review process and getting the library ready for inclusion in Boost (which should hopefully happen soon). Getting this issue fixed is definitely still on my TODO list. |
Ok, that is a very good reason. I'll just use the cpu for sorting for now. Thanks for your work and good luck with the peer review. |
radix sort by key with custom value type, fixes #162
Fixed by #701. |
Hello Kyle,
I tried to use compute::sort_by_key with a vector as key and a struct like that
as the value (or payload).
But unfortunately I cannot use this struct, only basic data types like int, float, double or so ...
Browsing the code it looks not too difficult to extend the current behaviour ...
/Jesko
The text was updated successfully, but these errors were encountered: