mirror of https://github.com/BOINC/boinc.git
Merge pull request #3453 from BOINC/dpa_processor_group
client (Win): find and show # of processor groups at startup;
This commit is contained in:
commit
06cb0cc3d7
|
@ -843,6 +843,16 @@ int ACTIVE_TASK::start(bool test) {
|
||||||
pid = process_info.dwProcessId;
|
pid = process_info.dwProcessId;
|
||||||
process_handle = process_info.hProcess;
|
process_handle = process_info.hProcess;
|
||||||
CloseHandle(process_info.hThread); // thread handle is not used
|
CloseHandle(process_info.hThread); // thread handle is not used
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
// if host has multiple processor groups (i.e. > 64 processors)
|
||||||
|
// see which one was used for this job, and show it
|
||||||
|
//
|
||||||
|
if (log_flags.task_debug && gstate.host_info.n_processor_groups > 0) {
|
||||||
|
int i = get_processor_group(process_handle);
|
||||||
|
msg_printf(wup->project, MSG_INFO, "[task_debug] task is running in processor group %d", i);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#elif defined(__EMX__)
|
#elif defined(__EMX__)
|
||||||
|
|
||||||
char* argv[100];
|
char* argv[100];
|
||||||
|
|
|
@ -1418,6 +1418,56 @@ int HOST_INFO::get_virtualbox_version() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get info about processor groups
|
||||||
|
//
|
||||||
|
static void show_proc_info(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX &pi) {
|
||||||
|
for (int i=0; i<pi.Group.ActiveGroupCount; i++) {
|
||||||
|
PROCESSOR_GROUP_INFO &pgi = pi.Group.GroupInfo[i];
|
||||||
|
msg_printf(NULL, MSG_INFO, "Windows processor group %d: %d processors",
|
||||||
|
i, pgi.ActiveProcessorCount
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef BOOL (WINAPI *GLPI)(
|
||||||
|
LOGICAL_PROCESSOR_RELATIONSHIP, PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, PDWORD
|
||||||
|
);
|
||||||
|
void HOST_INFO::win_get_processor_info() {
|
||||||
|
n_processor_groups = 0;
|
||||||
|
GLPI glpi = (GLPI) GetProcAddress(GetModuleHandle(_T("kernel32.dll")), "GetLogicalProcessorInformationEx");
|
||||||
|
if (!glpi) return;
|
||||||
|
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX buf[64];
|
||||||
|
DWORD size = sizeof(buf);
|
||||||
|
glpi(
|
||||||
|
RelationGroup,
|
||||||
|
buf,
|
||||||
|
&size
|
||||||
|
);
|
||||||
|
char *p = (char*)buf;
|
||||||
|
while (size > 0) {
|
||||||
|
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX pi = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX)p;
|
||||||
|
show_proc_info(*pi);
|
||||||
|
p += pi->Size;
|
||||||
|
size -= pi->Size;
|
||||||
|
n_processor_groups++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef BOOL (WINAPI *GPGA)(HANDLE, PUSHORT, PUSHORT);
|
||||||
|
int get_processor_group(HANDLE process_handle) {
|
||||||
|
USHORT groups[1], count;
|
||||||
|
static GPGA gpga = 0;
|
||||||
|
if (!gpga) {
|
||||||
|
gpga = (GPGA) GetProcAddress(GetModuleHandle(_T("kernel32.dll")), "GetProcessGroupAffinity");
|
||||||
|
}
|
||||||
|
if (!gpga) return 0;
|
||||||
|
count = 1;
|
||||||
|
BOOL ret = gpga(process_handle, &count, groups);
|
||||||
|
if (ret && count>0) {
|
||||||
|
return groups[0];
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Gets host information; called on startup and before each sched RPC
|
// Gets host information; called on startup and before each sched RPC
|
||||||
//
|
//
|
||||||
|
@ -1459,6 +1509,7 @@ int HOST_INFO::get_host_info(bool init) {
|
||||||
if (!strlen(host_cpid)) {
|
if (!strlen(host_cpid)) {
|
||||||
generate_host_cpid();
|
generate_host_cpid();
|
||||||
}
|
}
|
||||||
|
win_get_processor_info();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,10 @@ public:
|
||||||
int num_opencl_cpu_platforms;
|
int num_opencl_cpu_platforms;
|
||||||
OPENCL_CPU_PROP opencl_cpu_prop[MAX_OPENCL_CPU_PLATFORMS];
|
OPENCL_CPU_PROP opencl_cpu_prop[MAX_OPENCL_CPU_PLATFORMS];
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
int n_processor_groups;
|
||||||
|
#endif
|
||||||
|
|
||||||
void clear_host_info();
|
void clear_host_info();
|
||||||
HOST_INFO();
|
HOST_INFO();
|
||||||
|
|
||||||
|
@ -138,12 +142,16 @@ public:
|
||||||
char* os_name, const int os_name_size, char* os_version,
|
char* os_name, const int os_name_size, char* os_version,
|
||||||
const int os_version_size
|
const int os_version_size
|
||||||
);
|
);
|
||||||
|
#ifdef _WIN32
|
||||||
|
void win_get_processor_info();
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void make_secure_random_string(char*);
|
extern void make_secure_random_string(char*);
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
int get_wsl_information(bool& wsl_available, WSLS& wsls);
|
int get_wsl_information(bool& wsl_available, WSLS& wsls);
|
||||||
|
int get_processor_group(HANDLE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
|
Loading…
Reference in New Issue