mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-12-22 20:34:58 +01:00
Fixed huge_tlb flag on mac
This commit is contained in:
parent
6757810f56
commit
a2b2c9958a
@ -22,7 +22,11 @@ void* mmap_fortran(char* filename, size_t bytes, int* file_descr, int read_only)
|
|||||||
perror("Error opening mmap file for reading");
|
perror("Error opening mmap file for reading");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
#ifdef _GNU_SOURCE
|
||||||
map = mmap(NULL, bytes, PROT_READ, MAP_SHARED | MAP_HUGETLB, fd, 0);
|
map = mmap(NULL, bytes, PROT_READ, MAP_SHARED | MAP_HUGETLB, fd, 0);
|
||||||
|
#else
|
||||||
|
map = mmap(NULL, bytes, PROT_READ, MAP_SHARED, fd, 0);
|
||||||
|
#endif
|
||||||
if (map == MAP_FAILED) {
|
if (map == MAP_FAILED) {
|
||||||
/* try again without huge pages */
|
/* try again without huge pages */
|
||||||
map = mmap(NULL, bytes, PROT_READ, MAP_SHARED, fd, 0);
|
map = mmap(NULL, bytes, PROT_READ, MAP_SHARED, fd, 0);
|
||||||
@ -53,7 +57,11 @@ void* mmap_fortran(char* filename, size_t bytes, int* file_descr, int read_only)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _GNU_SOURCE
|
||||||
map = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_HUGETLB, fd, 0);
|
map = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_HUGETLB, fd, 0);
|
||||||
|
#else
|
||||||
|
map = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||||
|
#endif
|
||||||
if (map == MAP_FAILED) {
|
if (map == MAP_FAILED) {
|
||||||
/* try again without huge pages */
|
/* try again without huge pages */
|
||||||
map = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
map = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user