paddr_t _pmem_alloc(size_t size, size_t alignment, uintptr_t arg) { Debug1("size=%#lx (%lu) alignment=%lu arg=%#lx \n",size,size,alignment,arg); struct pmem_region* request = new struct pmem_region; if ( size & ( PAGE_SIZE-1 ) ) { size += PAGE_SIZE; size &= ~(PAGE_SIZE-1); } if ( pmem_alloc_umem( size, PAGE_SIZE, request ) ) { return -1; } if (pmem_zero(request)) return -1; void* vaddr = map( request->start, size ); if ( vaddr == (void*) -1 ) { _pmem_free( request->start ); return 0;//NULL; } memMap.insert( std::make_pair( vaddr, request ) ); // Debug1("paddr=%#lx vaddr=%p\n", request->start, vaddr ); return request->start; }
App::~App() { Debug( App, "enter\n"); m_orte.stopThread(); // we should call finiPid as each rank dies or move this to Orte for ( unsigned int i = 0; i < m_pidCpuMap.size(); i++ ) { m_orte.finiPid( m_pidCpuMap[i].pid ); } m_rdma.memRegionUnregister( ImageId ); mem_free( m_runTimeInfo ); mem_free( m_elfAddr ); for ( unsigned int i = 1; i < m_envAddrV.size(); i++ ) { mem_free( m_envAddrV[i] ); } while ( ! m_allocQ.empty() ) { _pmem_free( m_allocQ.front() ); m_allocQ.pop(); } for ( unsigned int i = 0; i < m_pidCpuMap.size(); i++ ) { if ( aspace_destroy( m_pidCpuMap[i].pid ) ) { Warn( App, "aspace_destroy( %d)\n", m_pidCpuMap[i].pid ); throw -1; } } Debug( App, "return\n"); }