Closed
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
Activity
github-actions commentedon Apr 9, 2024
This issue was closed because it has been inactive for 14 days since being marked as stale.