dst_private_blocks.clear();
dst_private_blocks.push_back(std::make_pair(0, buff_size));
}
-/*
- fprintf(stderr, "size: 0x%x\n", buff_size);
- fprintf(stderr, "src: ");
- print(src_private_blocks);
- fprintf(stderr, "src_offset = 0x%x\n", src_offset);
- fprintf(stderr, "dst: ");
- print(dst_private_blocks);
- fprintf(stderr, "dst_offset = 0x%x\n", dst_offset);
-*/
check_blocks(src_private_blocks, buff_size);
check_blocks(dst_private_blocks, buff_size);
auto private_blocks = merge_private_blocks(src_private_blocks, dst_private_blocks);
-/*
- fprintf(stderr, "Private blocks: ");
- print(private_blocks);
-*/
check_blocks(private_blocks, buff_size);
void* tmpbuff=buff;
if((smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) && (static_cast<char*>(buff) >= smpi_start_data_exe)
if(i_block < nb_shared_blocks-1)
xbt_assert(stop_offset < shared_block_offsets[2*i_block+2],
"stop_offset (%lu) should be lower than its successor start offset (%lu)", stop_offset, shared_block_offsets[2*i_block+2]);
-// fprintf(stderr, "shared block 0x%x - 0x%x\n", start_offset, stop_offset);
size_t start_block_offset = ALIGN_UP(start_offset, smpi_shared_malloc_blocksize);
size_t stop_block_offset = ALIGN_DOWN(stop_offset, smpi_shared_malloc_blocksize);
unsigned int i;
for (i = start_block_offset / smpi_shared_malloc_blocksize; i < stop_block_offset / smpi_shared_malloc_blocksize; i++) {
-// fprintf(stderr, "\tmmap:for 0x%x - 0x%x\n", i*smpi_shared_malloc_blocksize, smpi_shared_malloc_blocksize);
void* pos = (void*)((unsigned long)mem + i * smpi_shared_malloc_blocksize);
void* res = mmap(pos, smpi_shared_malloc_blocksize, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED | MAP_POPULATE,
smpi_shared_malloc_bogusfile, 0);
size_t low_page_start_offset = ALIGN_UP(start_offset, PAGE_SIZE);
size_t low_page_stop_offset = start_block_offset < ALIGN_DOWN(stop_offset, PAGE_SIZE) ? start_block_offset : ALIGN_DOWN(stop_offset, PAGE_SIZE);
if(low_page_start_offset < low_page_stop_offset) {
-// fprintf(stderr, "\tmmap:low 0x%x - 0x%x\n", low_page_start_offset, low_page_stop_offset-low_page_start_offset);
void* pos = (void*)((unsigned long)mem + low_page_start_offset);
void* res = mmap(pos, low_page_stop_offset-low_page_start_offset, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED | MAP_POPULATE,
smpi_shared_malloc_bogusfile, 0);
if(low_page_stop_offset <= stop_block_offset) {
size_t high_page_stop_offset = stop_offset == size ? size : ALIGN_DOWN(stop_offset, PAGE_SIZE);
if(high_page_stop_offset > stop_block_offset) {
-// fprintf(stderr, "\tmmap:high 0x%x - 0x%x\n", stop_block_offset, high_page_stop_offset-stop_block_offset);
void* pos = (void*)((unsigned long)mem + stop_block_offset);
void* res = mmap(pos, high_page_stop_offset-stop_block_offset, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED | MAP_POPULATE,
smpi_shared_malloc_bogusfile, 0);