src/occ_405/gpu/gpu.c
// Get GPU number for a GPU that needs power limits read
// returns 0xFF if no GPU needs power limits read
Get GPU number for a GPU that needs power limits read
returns 0xFF if no GPU needs power limits read
Get GPU number for a GPU that needs power limits read returns 0xFF if no GPU needs power limits read
uint8_t gpu_id_need_power_limits(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.check_pwr_limit))
            {
                if(G_pwr_reading_type == PWR_READING_TYPE_NONE)
                {
                    g_amec->gpu[i].pcap.check_pwr_limit = false;
                }
                else
                {
                    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_power_limits ( 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 . check_pwr_limit ) ) { if ( G_pwr_reading_type == PWR_READING_TYPE_NONE ) { g_amec -> gpu [ i ] . pcap . check_pwr_limit = false ; } else { 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 limits read
returns 0xFF if no GPU needs power limits read
Get GPU number for a GPU that needs power limits read returns 0xFF if no GPU needs power limits read
// default none // We attempted to read power limits for all GPUs // do not check any this time and start over with GPU 0 on next call // to read power limits requires that the driver is loaded // If there is no power capping support skip reading power limits // We don't need to read power limits from any GPUs at the moment // We're reading from last GPU, do not check any next time // Next time look at next GPU ID first