Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/src/solvers/dgsem_tree/dg_parallel.jl
5591 views
1
# By default, Julia/LLVM does not use fused multiply-add operations (FMAs).
2
# Since these FMAs can increase the performance of many numerical algorithms,
3
# we need to opt-in explicitly.
4
# See https://ranocha.de/blog/Optimizing_EC_Trixi for further details.
5
@muladd begin
6
#! format: noindent
7
8
# Function to output the mpi rank for visualization
9
function get_element_variables!(element_variables,
10
mesh::Union{TreeMeshParallel, P4estMeshParallel,
11
T8codeMeshParallel},
12
dg, cache)
13
element_variables[:mpi_rank] = ones(real(dg), nelements(mesh, dg, cache)) *
14
mpi_rank()
15
return nothing
16
end
17
18
# Initialize MPI data structures. This works for both the
19
# `TreeMesh` and the `P4estMesh` and is dimension-agnostic.
20
function init_mpi_data_structures(mpi_neighbor_interfaces, mpi_neighbor_mortars, n_dims,
21
nvars, n_nodes, uEltype)
22
data_size = nvars * n_nodes^(n_dims - 1)
23
n_small_elements = 2^(n_dims - 1)
24
mpi_send_buffers = Vector{Vector{uEltype}}(undef, length(mpi_neighbor_interfaces))
25
mpi_recv_buffers = Vector{Vector{uEltype}}(undef, length(mpi_neighbor_interfaces))
26
for index in 1:length(mpi_neighbor_interfaces)
27
mpi_send_buffers[index] = Vector{uEltype}(undef,
28
length(mpi_neighbor_interfaces[index]) *
29
data_size +
30
length(mpi_neighbor_mortars[index]) *
31
n_small_elements * 2 * data_size)
32
mpi_recv_buffers[index] = Vector{uEltype}(undef,
33
length(mpi_neighbor_interfaces[index]) *
34
data_size +
35
length(mpi_neighbor_mortars[index]) *
36
n_small_elements * 2 * data_size)
37
end
38
39
mpi_send_requests = Vector{MPI.Request}(undef, length(mpi_neighbor_interfaces))
40
mpi_recv_requests = Vector{MPI.Request}(undef, length(mpi_neighbor_interfaces))
41
42
return mpi_send_buffers, mpi_recv_buffers, mpi_send_requests, mpi_recv_requests
43
end
44
end # muladd
45
46