void getLineSliceFields() { typedef typename MappingDesc::SuperCellSize SuperCellSize; const float3_X tmpFloat3(float3_X(float_X(0.0), float_X(0.0), float_X(0.0))); sliceDataField->getDeviceBuffer().setValue(tmpFloat3); dim3 block(SuperCellSize::toRT().toDim3()); const SubGrid<simDim>& subGrid = Environment<simDim>::get().SubGrid(); // global cell id offset (without guardings!) // returns the global id offset of the "first" border cell on a GPU const DataSpace<simDim> globalCellIdOffset(subGrid.getLocalDomain().offset); // global number of cells for whole simulation: local cells on GPU * GPUs // (assumed same size on each gpu :-/ -> todo: provide interface!) //! \todo create a function for: global number of cells for whole simulation //! const DataSpace<simDim> localNrOfCells(subGrid.getLocalDomain().size); const DataSpace<simDim> globalNrOfCells (subGrid.getGlobalDomain().size); __picKernelArea(kernelLineSliceFields, *cellDescription, AREA) (block) (fieldE->getDeviceDataBox(), fieldB->getDeviceDataBox(), sliceDataField->getDeviceBuffer().getBasePointer(), globalCellIdOffset, globalNrOfCells ); sliceDataField->deviceToHost(); //return sliceDataField->getHostBuffer().getDataBox()[0]; }
SglParticle<FloatPos> getPositionsParticles(uint32_t currentStep) { typedef typename MappingDesc::SuperCellSize SuperCellSize; SglParticle<FloatPos> positionParticleTmp; gParticle->getDeviceBuffer().setValue(positionParticleTmp); dim3 block(SuperCellSize::getDataSpace()); __picKernelArea(kernelPositionsParticles, *cellDescription, AREA) (block) (particles->getDeviceParticlesBox(), gParticle->getDeviceBuffer().getBasePointer()); gParticle->deviceToHost(); DataSpace<simDim> localSize(cellDescription->getGridLayout().getDataSpaceWithoutGuarding()); VirtualWindow window(MovingWindow::getInstance().getVirtualWindow(currentStep)); DataSpace<simDim> gpuPhyCellOffset(SubGrid<simDim>::getInstance().getSimulationBox().getGlobalOffset()); gpuPhyCellOffset.y() += (localSize.y() * window.slides); gParticle->getHostBuffer().getDataBox()[0].globalCellOffset += gpuPhyCellOffset; return gParticle->getHostBuffer().getDataBox()[0]; }
void notify(uint32_t currentStep) { typedef typename MappingDesc::SuperCellSize SuperCellSize; DataConnector& dc = Environment<>::get().DataConnector(); fieldE = &(dc.getData<FieldE > (FieldE::getName(), true)); fieldB = &(dc.getData<FieldB > (FieldB::getName(), true)); const int rank = Environment<simDim>::get().GridController().getGlobalRank(); getLineSliceFields < CORE + BORDER > (); const SubGrid<simDim>& subGrid = Environment<simDim>::get().SubGrid(); // number of cells on the current CPU for each direction const DataSpace<simDim> nrOfGpuCells = cellDescription->getGridLayout().getDataSpaceWithoutGuarding(); // global cell id offset (without guardings!) // returns the global id offset of the "first" border cell on a GPU const DataSpace<simDim> globalCellIdOffset(subGrid.getLocalDomain().offset); // global number of cells for whole simulation: local cells on GPU * GPUs // (assumed same size on each gpu :-/ -> todo: provide interface!) //! \todo create a function for: global number of cells for whole simulation //! const DataSpace<simDim> globalNrOfCells = subGrid.getGlobalDomain().size; /*FORMAT OUTPUT*/ /** \todo add float3_X with position of the cell to output*/ // check if the current GPU contains the "middle slice" along // X_global / 2; Y_global / 2 over Z if (globalCellIdOffset.x() <= globalNrOfCells.x() / 2 && globalCellIdOffset.x() + nrOfGpuCells.x() > globalNrOfCells.x() / 2) #if(SIMDIM==DIM3) if( globalCellIdOffset.z() <= globalNrOfCells.z() / 2 && globalCellIdOffset.z() + nrOfGpuCells.z() > globalNrOfCells.z() / 2) #endif for (int i = 0; i < nrOfGpuCells.y(); ++i) { const double xPos = double( i + globalCellIdOffset.y()) * SI::CELL_HEIGHT_SI; outfile << currentStep << " " << rank << " "; outfile << xPos << " " /*<< sliceDataField->getHostBuffer().getDataBox()[i] */ << double(sliceDataField->getHostBuffer().getDataBox()[i].x()) * UNIT_EFIELD << " " << double(sliceDataField->getHostBuffer().getDataBox()[i].y()) * UNIT_EFIELD << " " << double(sliceDataField->getHostBuffer().getDataBox()[i].z()) * UNIT_EFIELD << " " << "\n"; } /* outfile << "[ANALYSIS] [" << rank << "] [COUNTER] [LineSliceFields] [" << currentStep << "] " << sliceDataField << "\n"; */ // free line to separate timesteps in gnuplot via the "index" option outfile << std::endl; }