| 123456789101112131415161718192021222324252627282930313233343536 |
- #include <string.h>
- #include <oclh.h>
- #include <oclh_h_base_dev_clapi_wrappers.h>
- int32_t main(int32_t argc, char *argv[]) {
- /**/
- #define __CLEAN_GET_DEV_NAME_BY_IDX_INFRASTRUCTURE_AND_EXIT \
- { if(pcDevName) { free(pcDevName); pcDevName=NULL; } \
- _ghf_wipeDevList(&DevLst); _ghf_wipeWS(&tmpWS); \
- _ghf_wipeLog(&Log); return(err); }
- /**/
- int32_t err=0;
- if(argc<2) return(1);
- {
- _GHT_LOG Log=_ghf_declLog();
- _GHT_WRKSET tmpWS=_ghf_declWS();
- cl_uint cluDevIdx=(cl_uint)strtoul((argc>1)?argv[1]:"",NULL,10);
- char* pcDevName=NULL;
- cl_device_id* DevLst=NULL;
- if((err=_ghf_genrLog(&Log,"/dev/null")))
- __CLEAN_GET_DEV_NAME_BY_IDX_INFRASTRUCTURE_AND_EXIT;
- tmpWS.Log=Log; tmpWS.pwSetAddr=&tmpWS;
- if((err=_ghf_buildDevList(tmpWS,&DevLst)))
- __CLEAN_GET_DEV_NAME_BY_IDX_INFRASTRUCTURE_AND_EXIT;
- pcDevName=_ghf_getDevInf_charptr(DevLst[cluDevIdx],CL_DEVICE_NAME,&err);
- if(err) __CLEAN_GET_DEV_NAME_BY_IDX_INFRASTRUCTURE_AND_EXIT;
- __ghf_removePreNPostSpacesFromCharPtr(pcDevName);
- __ghf_replaceIllegalFSCharsInCharPtr(pcDevName);
- __ghf_replaceSpacesWithUnderscoreInCharPtr(pcDevName);
- printf("%s\n",pcDevName);
- __CLEAN_GET_DEV_NAME_BY_IDX_INFRASTRUCTURE_AND_EXIT;
- }
- /**/
- #undef __CLEAN_GET_DEV_NAME_BY_IDX_INFRASTRUCTURE_AND_EXIT
- /**/
- }
|