void seissol::checkpoint::posix::Wavefield::write(double time, int timestepWaveField) { EPIK_TRACER("CheckPoint_write"); SCOREP_USER_REGION("CheckPoint_write", SCOREP_USER_REGION_TYPE_FUNCTION); logInfo(rank()) << "Checkpoint backend: Writing."; // Start at the beginning checkErr(lseek64(file(), 0, SEEK_SET)); // Write the header EPIK_USER_REG(r_write_header, "checkpoint_write_header"); SCOREP_USER_REGION_DEFINE(r_write_header); EPIK_USER_START(r_write_header); SCOREP_USER_REGION_BEGIN(r_write_header, "checkpoint_write_header", SCOREP_USER_REGION_TYPE_COMMON); WavefieldHeader header; header.time = time; header.timestepWaveField = timestepWaveField; writeHeader(file(), header); EPIK_USER_END(r_write_header); SCOREP_USER_REGION_END(r_write_header); // Save data EPIK_USER_REG(r_write_wavefield, "checkpoint_write_wavefield"); SCOREP_USER_REGION_DEFINE(r_write_wavefield); EPIK_USER_START(r_write_wavefield); SCOREP_USER_REGION_BEGIN(r_write_wavefield, "checkpoint_write_wavefield", SCOREP_USER_REGION_TYPE_COMMON); // Convert to char* to do pointer arithmetic const char* buffer = reinterpret_cast<const char*>(dofs()); unsigned long left = numDofs()*sizeof(real); if (alignment()) { left = (left + alignment() - 1) / alignment(); left *= alignment(); } while (left > 0) { unsigned long written = ::write(file(), buffer, left); if (written <= 0) checkErr(written, left); buffer += written; left -= written; } EPIK_USER_END(r_write_wavefield); SCOREP_USER_REGION_END(r_write_wavefield); // Finalize the checkpoint finalizeCheckpoint(); logInfo(rank()) << "Checkpoint backend: Writing. Done."; }
void seissol::checkpoint::posix::Wavefield::write(double time, int timestepWaveField) { EPIK_TRACER("CheckPoint_write"); SCOREP_USER_REGION("CheckPoint_write", SCOREP_USER_REGION_TYPE_FUNCTION); logInfo(rank()) << "Writing check point."; // Skip identifier checkErr(lseek64(file(), sizeof(unsigned long), SEEK_SET)); // Write the header EPIK_USER_REG(r_write_header, "checkpoint_write_header"); SCOREP_USER_REGION_DEFINE(r_write_header); EPIK_USER_START(r_write_header); SCOREP_USER_REGION_BEGIN(r_write_header, "checkpoint_write_header", SCOREP_USER_REGION_TYPE_COMMON); checkErr(::write(file(), &time, sizeof(time)), sizeof(time)); checkErr(::write(file(), ×tepWaveField, sizeof(timestepWaveField)), sizeof(timestepWaveField)); EPIK_USER_END(r_write_header); SCOREP_USER_REGION_END(r_write_header); // Save data EPIK_USER_REG(r_write_wavefield, "checkpoint_write_wavefield"); SCOREP_USER_REGION_DEFINE(r_write_wavefield); EPIK_USER_START(r_write_wavefield); SCOREP_USER_REGION_BEGIN(r_write_wavefield, "checkpoint_write_wavefield", SCOREP_USER_REGION_TYPE_COMMON); // Convert to char* to do pointer arithmetic const char* buffer = reinterpret_cast<const char*>(dofs()); unsigned long left = numDofs()*sizeof(real); while (left > 0) { unsigned long written = ::write(file(), buffer, left); if (written <= 0) checkErr(written, left); buffer += written; left -= written; } EPIK_USER_END(r_write_wavefield); SCOREP_USER_REGION_END(r_write_wavefield); // Finalize the checkpoint finalizeCheckpoint(); logInfo(rank()) << "Writing check point. Done."; }
void seissol::checkpoint::mpio::WavefieldAsync::writePrepare(double time, int timestepWaveField) { EPIK_TRACER("CheckPoint_writePrepare"); SCOREP_USER_REGION("CheckPoint_writePrepare", SCOREP_USER_REGION_TYPE_FUNCTION); // Write the header writeHeader(time, timestepWaveField); // Create copy of the dofs memcpy(m_dofsCopy, dofs(), numDofs()*sizeof(real)); // Save data EPIK_USER_REG(r_write_wavefield, "checkpoint_write_begin_wavefield"); SCOREP_USER_REGION_DEFINE(r_write_wavefield); EPIK_USER_START(r_write_wavefield); SCOREP_USER_REGION_BEGIN(r_write_wavefield, "checkpoint_write_begin_wavefield", SCOREP_USER_REGION_TYPE_COMMON); checkMPIErr(setDataView(file())); checkMPIErr(MPI_File_write_all_begin(file(), m_dofsCopy, numDofs(), MPI_DOUBLE)); EPIK_USER_END(r_write_wavefield); SCOREP_USER_REGION_END(r_write_wavefield); m_started = true; logInfo(rank()) << "Checkpoint backend: Writing. Done."; }
void seissol::checkpoint::mpio::FaultAsync::writePrepare(int timestepFault) { EPIK_TRACER("CheckPointFault_writePrepare"); SCOREP_USER_REGION("CheckPointFault_writePrepare", SCOREP_USER_REGION_TYPE_FUNCTION); if (numSides() == 0) return; // Write the header writeHeader(timestepFault); // Create copy of the data for (unsigned int i = 0; i < NUM_VARIABLES; i++) memcpy(&m_dataCopy[i*numSides()*numBndGP()], data(i), numSides()*numBndGP()*sizeof(double)); // Save data EPIK_USER_REG(r_write_wavefield, "checkpoint_write_begin_fault"); SCOREP_USER_REGION_DEFINE(r_write_fault); EPIK_USER_START(r_write_wavefield); SCOREP_USER_REGION_BEGIN(r_write_fault, "checkpoint_write_begin_fault", SCOREP_USER_REGION_TYPE_COMMON); checkMPIErr(setDataView(file())); checkMPIErr(MPI_File_write_all_begin(file(), m_dataCopy, numSides() * numBndGP() * NUM_VARIABLES, MPI_DOUBLE)); EPIK_USER_END(r_write_fault); SCOREP_USER_REGION_END(r_write_fault); m_started = true; logInfo(rank()) << "Writing fault check point. Done."; }
void seissol::checkpoint::mpio::Wavefield::write(double time, int timestepWaveField) { EPIK_TRACER("CheckPoint_write"); SCOREP_USER_REGION("CheckPoint_write", SCOREP_USER_REGION_TYPE_FUNCTION); logInfo(rank()) << "Writing check point."; // Write the header writeHeader(time, timestepWaveField); // Save data EPIK_USER_REG(r_write_wavefield, "checkpoint_write_wavefield"); SCOREP_USER_REGION_DEFINE(r_write_wavefield); EPIK_USER_START(r_write_wavefield); SCOREP_USER_REGION_BEGIN(r_write_wavefield, "checkpoint_write_wavefield", SCOREP_USER_REGION_TYPE_COMMON); checkMPIErr(setDataView(file())); checkMPIErr(MPI_File_write_all(file(), dofs(), numDofs(), MPI_DOUBLE, MPI_STATUS_IGNORE)); EPIK_USER_END(r_write_wavefield); SCOREP_USER_REGION_END(r_write_wavefield); // Finalize the checkpoint finalizeCheckpoint(); logInfo(rank()) << "Writing check point. Done."; }
void seissol::checkpoint::h5::Fault::write(int timestepFault) { EPIK_TRACER("CheckPointFault_write"); SCOREP_USER_REGION("CheckPointFault_write", SCOREP_USER_REGION_TYPE_FUNCTION); if (numSides() == 0) return; logInfo(rank()) << "Writing fault check point."; // Create array with all pointers EPIK_USER_REG(r_write_fault, "checkpoint_write_fault"); SCOREP_USER_REGION_DEFINE(r_write_fault); EPIK_USER_START(r_write_fault); SCOREP_USER_REGION_BEGIN(r_write_fault, "checkpoint_write_fault", SCOREP_USER_REGION_TYPE_COMMON); // Attributes checkH5Err(H5Awrite(m_h5timestepFault[odd()], H5T_NATIVE_INT, ×tepFault)); // Set memory and file space hsize_t fStart[2] = {fileOffset(), 0}; hsize_t count[2] = {numSides(), numBndGP()}; hid_t h5memSpace = H5Screate_simple(2, count, 0L); checkH5Err(h5memSpace); checkH5Err(H5Sselect_all(h5memSpace)); checkH5Err(H5Sselect_hyperslab(m_h5fSpaceData, H5S_SELECT_SET, fStart, 0L, count, 0L)); for (unsigned int i = 0; i < NUM_VARIABLES; i++) { checkH5Err(H5Dwrite(m_h5data[odd()][i], H5T_NATIVE_DOUBLE, h5memSpace, m_h5fSpaceData, h5XferList(), data(i))); } checkH5Err(H5Sclose(h5memSpace)); EPIK_USER_END(r_write_fault); SCOREP_USER_REGION_END(r_write_fault); // Finalize the checkpoint finalizeCheckpoint(); logInfo(rank()) << "Writing fault check point. Done."; }
void seissol::checkpoint::h5::Wavefield::write(double time, int waveFieldTimeStep) { EPIK_TRACER("CheckPoint_write"); SCOREP_USER_REGION("CheckPoint_write", SCOREP_USER_REGION_TYPE_FUNCTION); logInfo(rank()) << "Writing check point."; EPIK_USER_REG(r_header, "checkpoint_write_header"); SCOREP_USER_REGION_DEFINE(r_header); EPIK_USER_START(r_header); SCOREP_USER_REGION_BEGIN(r_header, "checkpoint_write_header", SCOREP_USER_REGION_TYPE_COMMON); // Time checkH5Err(H5Awrite(m_h5time[odd()], H5T_NATIVE_DOUBLE, &time)); // Wavefield writer checkH5Err(H5Awrite(m_h5timestepWavefield[odd()], H5T_NATIVE_INT, &waveFieldTimeStep)); EPIK_USER_END(r_header); SCOREP_USER_REGION_END(r_header); // Save data EPIK_USER_REG(r_write_wavefield, "checkpoint_write_wavefield"); SCOREP_USER_REGION_DEFINE(r_write_wavefield); EPIK_USER_START(r_write_wavefield); SCOREP_USER_REGION_BEGIN(r_write_wavefield, "checkpoint_write_wavefield", SCOREP_USER_REGION_TYPE_COMMON); // Write the wave field unsigned int offset = 0; hsize_t fStart = fileOffset(); hsize_t count = dofsPerIteration(); hid_t h5memSpace = H5Screate_simple(1, &count, 0L); checkH5Err(h5memSpace); checkH5Err(H5Sselect_all(h5memSpace)); for (unsigned int i = 0; i < totalIterations()-1; i++) { checkH5Err(H5Sselect_hyperslab(m_h5fSpaceData, H5S_SELECT_SET, &fStart, 0L, &count, 0L)); checkH5Err(H5Dwrite(m_h5data[odd()], H5T_NATIVE_DOUBLE, h5memSpace, m_h5fSpaceData, h5XferList(), &const_cast<real*>(dofs())[offset])); // We are finished in less iterations, read data twice // so everybody needs the same number of iterations if (i < iterations()-1) { fStart += count; offset += count; } } checkH5Err(H5Sclose(h5memSpace)); // Save reminding data in the last iteration count = numDofs() - (iterations() - 1) * count; h5memSpace = H5Screate_simple(1, &count, 0L); checkH5Err(h5memSpace); checkH5Err(H5Sselect_all(h5memSpace)); checkH5Err(H5Sselect_hyperslab(m_h5fSpaceData, H5S_SELECT_SET, &fStart, 0L, &count, 0L)); checkH5Err(H5Dwrite(m_h5data[odd()], H5T_NATIVE_DOUBLE, h5memSpace, m_h5fSpaceData, h5XferList(), &dofs()[offset])); checkH5Err(H5Sclose(h5memSpace)); EPIK_USER_END(r_write_wavefield); SCOREP_USER_REGION_END(r_write_wavefield); // Finalize the checkpoint finalizeCheckpoint(); logInfo(rank()) << "Writing check point. Done."; }