MCPcopy Create free account
hub / github.com/SeisSol/SeisSol / addTimeIntegratedPointSources

Method addTimeIntegratedPointSources

src/Kernels/PointSourceClusterOnDevice.cpp:32–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30unsigned PointSourceClusterOnDevice::size() const { return sources_->numberOfSources; }
31
32void PointSourceClusterOnDevice::addTimeIntegratedPointSources(
33 double from, double to, seissol::parallel::runtime::StreamRuntime& runtime) {
34 auto& queue = seissol::AcceleratorDevice::getInstance().getSyclDefaultQueue();
35 auto& mapping = clusterMapping_->cellToSources;
36 if (mapping.size() > 0) {
37 runtime.syncToSycl(&queue);
38
39 auto* mappingPtr = mapping.data();
40 auto* mInvJInvPhisAtSources = sources_->mInvJInvPhisAtSources.data();
41 auto* tensor = sources_->tensor.data();
42 auto* a = sources_->A.data();
43 auto* stiffnessTensor = sources_->stiffnessTensor.data();
44 auto* onsetTime = sources_->onsetTime.data();
45 auto* samplingInterval = sources_->samplingInterval.data();
46 auto sampleOffsets = std::array<std::size_t*, 3u>{sources_->sampleOffsets[0].data(),
47 sources_->sampleOffsets[1].data(),
48 sources_->sampleOffsets[2].data()};
49 auto sample = std::array<real*, 3u>{
50 sources_->sample[0].data(), sources_->sample[1].data(), sources_->sample[2].data()};
51
52 sycl::range rng{mapping.size()};
53 if (sources_->mode == sourceterm::PointSourceMode::Nrf) {
54 queue.submit([&](sycl::handler& cgh) {
55 cgh.parallel_for(rng, [=](sycl::item<1> id) {
56 const unsigned startSource = mappingPtr[id[0]].pointSourcesOffset;
57 const unsigned endSource =
58 mappingPtr[id[0]].pointSourcesOffset + mappingPtr[id[0]].numberOfPointSources;
59 for (unsigned source = startSource; source < endSource; ++source) {
60 std::array<real, 3u> slip;
61 for (int i = 0; i < 3; ++i) {
62 auto o0 = sampleOffsets[i][source];
63 auto o1 = sampleOffsets[i][source + 1];
64 slip[i] = computeSampleTimeIntegral<seissol::functions::SyclStdFunctions>(
65 from, to, onsetTime[source], samplingInterval[source], sample[i] + o0, o1 - o0);
66 }
67
68 addTimeIntegratedPointSourceNRF(slip,
69 mInvJInvPhisAtSources[source].data(),
70 tensor[source].data(),
71 a[source],
72 stiffnessTensor[source].data(),
73 from,
74 to,
75 *mappingPtr[id[0]].dofs);
76 }
77 });
78 });
79 } else {
80 queue.submit([&](sycl::handler& cgh) {
81 cgh.parallel_for(rng, [=](sycl::item<1> id) {
82 const unsigned startSource = mappingPtr[id[0]].pointSourcesOffset;
83 const unsigned endSource =
84 mappingPtr[id[0]].pointSourcesOffset + mappingPtr[id[0]].numberOfPointSources;
85 for (unsigned source = startSource; source < endSource; ++source) {
86 auto o0 = sampleOffsets[0][source];
87 auto o1 = sampleOffsets[0][source + 1];
88 const real slip = computeSampleTimeIntegral<seissol::functions::SyclStdFunctions>(
89 from, to, onsetTime[source], samplingInterval[source], sample[0] + o0, o1 - o0);

Callers

nothing calls this directly

Calls 4

syncToSyclMethod · 0.80
syncFromSyclMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected