Returns error message.

int mira_RefreshDeviceList(mrkernel *pmr,int listNVIDIA,int listOpenCL)


  • Runtime environment pointer pmr
  • Flag whether to search for and list NVIDIA devices (0: no, 1: yes)
  • Flag whether to search for and list OpenCL devices (0: no, 1: yes)

Output: Result: MIRA_OK or error code


mira_RefreshDeviceList searches for computational devices (NVIDIA or OpenCL). After calling mira_RefreshDeviceList, one can get device count using mira_GetDeviceCount and names with mira_GetDeviceName.


   MIRA_CHECK( mira_RefreshDeviceList(pmr,1,0) );

   const int devCount=mira_GetDeviceCount(pmr);

   printf("\n%d devices:\n",devCount);

   for(int i=0;i<devCount;i++) {

       printf("%d : %s\n",i, mira_GetDeviceName(pmr,i));


   int deviceInd=atoi(argv[1]);

   MIRA_CHECK( mira_SetDevice(pmr,deviceInd) );

   printf("Device selected: %d '%s'\n",deviceInd,mira_GetDeviceName(pmr,deviceInd));

The MIRA_CHECK macro checks the output result. If error occurs, the program flow is terminated. See perclass_mira.h definition.