Skip to content

Commit e089f46

Browse files
committed
Show configured RAM speed
1 parent 6bde6cd commit e089f46

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

OpenBLAS

hardware.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "stdlib.h"
99
#include "sys/stat.h"
1010
#include "unistd.h"
11+
#include "stdbool.h"
1112

1213
#include "omp.h"
1314

@@ -45,7 +46,7 @@ uint64_t hardware_instruction_set() {
4546
}
4647
}
4748

48-
uint64_t hardware_ram_speed() {
49+
uint64_t hardware_ram_speed(bool configured) {
4950
glob_t dmiglob;
5051
uint16_t ram_speed;
5152
assert(!glob("/sys/firmware/dmi/entries/17-*/raw", 0, NULL, &dmiglob));
@@ -55,7 +56,7 @@ uint64_t hardware_ram_speed() {
5556
return 0;
5657
}
5758
struct stat size;
58-
fseek(file, 0x15, SEEK_SET);
59+
fseek(file, configured ? 0x20 : 0x15, SEEK_SET);
5960
while(!fread((void*) &ram_speed, sizeof(uint16_t), 1, file));
6061
fclose(file);
6162
if(ram_speed) {

hardware.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ extern const uint64_t HARDWARE_HAS_AVX512;
44

55
uint64_t hardware_is_needlessly_disabled();
66
uint64_t hardware_instruction_set();
7-
uint64_t hardware_ram_speed();
7+
uint64_t hardware_ram_speed(bool configured);
88
uint64_t hardware_cpu_count();

manganese.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "string.h"
66
#include "assert.h"
77
#include "time.h"
8+
#include "stdbool.h"
89

910
#include "sys/sysinfo.h"
1011
#include "sys/mman.h"
@@ -23,7 +24,7 @@ int main(int argc, char** argv) {
2324
const double fraction = atof(argv[1]) / 100;
2425

2526
const uint64_t cpu_count = hardware_cpu_count();
26-
const uint64_t ram_speed = hardware_ram_speed();
27+
const uint64_t ram_speed = hardware_ram_speed(true);
2728
const uint64_t isa = hardware_instruction_set();
2829

2930
if(isa == HARDWARE_HAS_SSE) {

0 commit comments

Comments
 (0)