src/occ_405/gpu/gpu.c
// Get GPU number for a GPU that needs power limit set
// returns 0xFF if no GPU needs power limit set
Get GPU number for a GPU that needs power limit set
returns 0xFF if no GPU needs power limit set
Get GPU number for a GPU that needs power limit set returns 0xFF if no GPU needs power limit set
uint8_t gpu_id_need_set_power_limit(void)
{
    uint8_t gpu_id = 0xFF;  
    uint8_t i = 0;
    static uint8_t L_current_gpu_id = 0;
    if(0xFF == L_current_gpu_id)
    {
        L_current_gpu_id = 0;
    }
    else
    {
        for (i=L_current_gpu_id; i<MAX_NUM_GPU_PER_DOMAIN; i++)
        {
            if( (g_amec->gpu[i].status.driverLoaded) && (g_amec->gpu[i].pcap.pwr_limits_read) &&
                (!g_amec->gpu[i].pcap.set_failed) && (g_amec->gpu[i].pcap.gpu_desired_pcap_mw != 0) &&
                (g_amec->gpu[i].pcap.gpu_desired_pcap_mw != g_amec->gpu[i].pcap.gpu_requested_pcap_mw) )
            {
               gpu_id = i;
               break;
            }
        }
        if(0xFF == gpu_id)
        {
            L_current_gpu_id = 0;
        }
        else if( (MAX_NUM_GPU_PER_DOMAIN - 1) == gpu_id )
        {
            L_current_gpu_id = 0xFF;
        }
        else
        {
            L_current_gpu_id = gpu_id + 1;
        }
    }
    return gpu_id;
}
uint8_t gpu_id_need_set_power_limit ( void ) { uint8_t gpu_id = 0xFF ; uint8_t i = 0 ; static uint8_t L_current_gpu_id = 0 ; if ( 0xFF == L_current_gpu_id ) { L_current_gpu_id = 0 ; } else { for ( i = L_current_gpu_id ; i < MAX_NUM_GPU_PER_DOMAIN ; i ++ ) { if ( ( g_amec -> gpu [ i ] . status . driverLoaded ) && ( g_amec -> gpu [ i ] . pcap . pwr_limits_read ) && ( ! g_amec -> gpu [ i ] . pcap . set_failed ) && ( g_amec -> gpu [ i ] . pcap . gpu_desired_pcap_mw != 0 ) && ( g_amec -> gpu [ i ] . pcap . gpu_desired_pcap_mw != g_amec -> gpu [ i ] . pcap . gpu_requested_pcap_mw ) ) { gpu_id = i ; break ; } } if ( 0xFF == gpu_id ) { L_current_gpu_id = 0 ; } else if ( ( MAX_NUM_GPU_PER_DOMAIN - 1 ) == gpu_id ) { L_current_gpu_id = 0xFF ; } else { L_current_gpu_id = gpu_id + 1 ; } } return gpu_id ; }
Get GPU number for a GPU that needs power limit set
returns 0xFF if no GPU needs power limit set
Get GPU number for a GPU that needs power limit set returns 0xFF if no GPU needs power limit set
// default none // We've checked to see if all GPUs need a power cap set, start over // with GPU 0 next time // to set power limit requires that the driver is loaded and power limits were read // no GPU needs checking start back at 0 next time // Last GPU is being set do not check any next time // next time look at the next GPU ID first