diff options
author | SIGSEGV <21287366+akr2002@users.noreply.github.com> | 2023-07-11 21:39:48 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-11 21:39:48 +0530 |
commit | 7f75f68795e0a84c06cc790c17e8e471ca6f00f9 (patch) | |
tree | 392dab7137dc44f612b3f0c17b2329cf4c829bbe /llama-util.h | |
parent | c1f29d1bb1d9f3084c9dc177fe9bf9269b9e35af (diff) | |
parent | 917831c63a4138814d23da1917bf2b5d5b9faa6c (diff) |
Merge branch 'ggerganov:master' into master
Diffstat (limited to 'llama-util.h')
-rw-r--r-- | llama-util.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llama-util.h b/llama-util.h index 042ebe4..43b6f05 100644 --- a/llama-util.h +++ b/llama-util.h @@ -175,13 +175,13 @@ struct llama_mmap { llama_mmap(struct llama_file * file, size_t prefetch = (size_t) -1 /* -1 = max value */, bool numa = false) { size = file->size; int fd = fileno(file->fp); - int flags = MAP_SHARED; + int flags = MAP_PRIVATE; // prefetch/readahead impairs performance on NUMA systems if (numa) { prefetch = 0; } #ifdef __linux__ if (prefetch) { flags |= MAP_POPULATE; } #endif - addr = mmap(NULL, file->size, PROT_READ, flags, fd, 0); + addr = mmap(NULL, file->size, PROT_READ | PROT_WRITE, flags, fd, 0); if (addr == MAP_FAILED) { throw std::runtime_error(format("mmap failed: %s", strerror(errno))); } @@ -223,7 +223,7 @@ struct llama_mmap { throw std::runtime_error(format("CreateFileMappingA failed: %s", llama_format_win_err(error).c_str())); } - addr = MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, 0); + addr = MapViewOfFile(hMapping, FILE_MAP_COPY, 0, 0, 0); error = GetLastError(); CloseHandle(hMapping); |