use disk.read_rnd.bw in termux

This commit is contained in:
Lizonghang 2024-12-11 14:56:08 +04:00
parent dfb37671d3
commit 28ebc6478a

View file

@ -1397,12 +1397,16 @@ static float device_disk_access_delay(struct device_info & dev_info, struct llam
#else #else
#if defined(__linux__) #if defined(__linux__)
if (getenv("TERMUX_VERSION") == NULL) {
// if this linux not in termux env, use sequantial read bandwidth
// POSIX_FADV_SEQUENTIAL is set on linux // POSIX_FADV_SEQUENTIAL is set on linux
float disk_read_bw = dev_info.disk.read_seq_bw * 1e9 / 1024.0 / 1024.0 / 1024.0; float disk_read_bw = dev_info.disk.read_seq_bw * 1e9 / 1024.0 / 1024.0 / 1024.0;
#else }
float disk_read_bw = dev_info.disk.read_rnd_bw * 1e9 / 1024.0 / 1024.0 / 1024.0;
#endif #endif
// non-linux and linux in termux
float disk_read_bw = dev_info.disk.read_rnd_bw * 1e9 / 1024.0 / 1024.0 / 1024.0;
// only part of the mapped tensors needs to be re-loaded // only part of the mapped tensors needs to be re-loaded
float gbytes_to_load = cpu_total_bytes_gib - (cpu_mem_avail - cpu_kv_size_gib - cpu_compute_buf_gib); float gbytes_to_load = cpu_total_bytes_gib - (cpu_mem_avail - cpu_kv_size_gib - cpu_compute_buf_gib);
return gbytes_to_load / disk_read_bw * 1000; // convert to ms return gbytes_to_load / disk_read_bw * 1000; // convert to ms