-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Closed
Labels
enhancementNew feature or requestNew feature or requesthardwareHardware relatedHardware relatedstalethreadingParallel processing and thread managementParallel processing and thread managementwindowsIssues specific to WindowsIssues specific to Windows
Description
Complete #934 with the windows impl of physical cores
The impl is approximately:
DWORD buffer_size = 0;
DWORD result = GetLogicalProcessorInformation(NULL, &buffer_size);
// assert result == FALSE && GetLastError() == ERROR_INSUFFICIENT_BUFFER
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION buffer = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION)malloc(buffer_size);
result = GetLogicalProcessorInformation(buffer, &buffer_size);
if (result != FALSE) {
int num_physical_cores = 0;
DWORD_PTR byte_offset = 0;
while (byte_offset < buffer_size) {
if (buffer->Relationship == RelationProcessorCore) {
num_physical_cores++;
}
byte_offset += sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION);
buffer++;
}
std::cout << "Number of physical cores: " << num_physical_cores << std::endl;
} else {
std::cerr << "Error getting logical processor information: " << GetLastError() << std::endl;
}
free(buffer);The location of the change is here: https://github.com/ggerganov/llama.cpp/blob/4a98a0f21ad63d97a643ba6fb21f613cb596cb23/examples/common.cpp#L57
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthardwareHardware relatedHardware relatedstalethreadingParallel processing and thread managementParallel processing and thread managementwindowsIssues specific to WindowsIssues specific to Windows