Sets specific computational device


int mira_SetDevice(mrkernel* pmr,int deviceInd)


Input: 

  • Runtime environment pointer
  • Device index


Output: Result code (MIRA_OK or error)


Description:

mira_SetDevice sets specific computational device. The device list needs to be constructed by mira_RefreshDeviceList


Example: 

    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.