boda
boda copied to clipboard
NESI default arguments for rtc_compute
I've added a new variable in rtc_compute_t
:
uint32_t use_device_no; //NESI(default=0,help="device number of OpenCL device to use")
With this variable, a user can choose which device to use if multiple ones are available. However when I run my testing mode
struct auto_tuner_tester_t : virtual public nesi, public has_main_t // NESI(help="get OpenCL/CUDA device informations",
// bases=["has_main_t"], type_id="device_information" )
{
p_rtc_compute_t rtc;
rtc_device_info_t dev_info;
virtual cinfo_t const * get_cinfo( void ) const; // required declaration for NESI support
virtual void main(nesi_init_arg_t * nia) {
rtc = make_p_rtc_compute_t_init_and_check_unused_from_lexp( parse_lexp( "(be=ocl)" ), nia );
rtc->init();
dev_info = rtc->get_device_info();
printf("%s %d %d\n", dev_info.device_name.c_str(), dev_info.wg_sz, dev_info.mem_sz);
}
};
with ./boda device_information --use_device_no=0
, Boda throws an error: error: unused input: use_device_no:0
So how do I have to set this variable in my input, or is it simply a bug?
If you point me to a branch where I can run your test I'll take a look.
On Aug 7, 2017 5:40 AM, "dinhv" [email protected] wrote:
I've added a new variable in rtc_compute_t: uint32_t use_device_no; //NESI(default=0,help="device number of OpenCL device to use")
With this variable, a user can choose which device to use if multiple ones are available. However when I run my testing mode
struct auto_tuner_tester_t : virtual public nesi, public has_main_t // NESI(help="get OpenCL/CUDA device informations", // bases=["has_main_t"], type_id="device_information" ) { p_rtc_compute_t rtc; rtc_device_info_t dev_info;
virtual cinfo_t const * get_cinfo( void ) const; // required declaration for NESI support virtual void main(nesi_init_arg_t * nia) { rtc = make_p_rtc_compute_t_init_and_check_unused_from_lexp( parse_lexp( "(be=ocl)" ), nia ); rtc->init(); dev_info = rtc->get_device_info(); printf("%s %d %d\n", dev_info.device_name.c_str(), dev_info.wg_sz, dev_info.mem_sz); }
};
with ./boda device_information --use_device_no=0, Boda throws an error: error: unused input: use_device_no:0
So how do I have to set this variable in my input, or is it simply a bug?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/moskewcz/boda/issues/24, or mute the thread https://github.com/notifications/unsubscribe-auth/AGL-s0nhExZmVkyKXjBA3AJbrjChbEbOks5sVwXVgaJpZM4OvYdw .
looking at this in more detail, i think i see what's happening, and i can give some additional information:
- i don't think this is a bug, but you might call it a limitation: you're passing an option to 'auto_tuner_tester_t' that isn't used (use_device_no), which is (at least by default) an error. if it wasn't, you could accidentally pass anything to auto_tuner_tester_t, and it wouldn't complain, which would be very error-prone/confusing from a UI standpoint.
- your usage of rtc as a non-NESI field is odd. if there's no reason to create it dynamically/manually, then you should not -- instead you should let NESI do it. the way you have it, you can't directly specify the options for rtc. as a bonus, NESI can't understand that you're trying to pass that use_device_no option down to to (NESI processing is done before main() is called). you might consider something more like the common usage of fields like rtc:
p_rtc_compute_t rtc; //NESI(default="(be=ocl)",help="rtc back-end to use")
- if you can't do that, there are other possible workarounds/solutions. one thing to do is to make a use_device_no NESI field at the level of auto_tuner_tester_t to silence the unused arg warning/error:
... inside auto_tuner_tester_t
uint32_t use_device_no; //NESI(default=0,help="device number of rtc device to use")
...
this field will actually get set (even if it is unused at the application level), and thus there will be no 'unused input' error. but the user-specified input will still be present in the nia as well, so it should be seen/used by the dynamically-created rtc object as well.