Path: blob/main/src/solvers/dgsem_tree/dg_parallel.jl
5591 views
# By default, Julia/LLVM does not use fused multiply-add operations (FMAs).1# Since these FMAs can increase the performance of many numerical algorithms,2# we need to opt-in explicitly.3# See https://ranocha.de/blog/Optimizing_EC_Trixi for further details.4@muladd begin5#! format: noindent67# Function to output the mpi rank for visualization8function get_element_variables!(element_variables,9mesh::Union{TreeMeshParallel, P4estMeshParallel,10T8codeMeshParallel},11dg, cache)12element_variables[:mpi_rank] = ones(real(dg), nelements(mesh, dg, cache)) *13mpi_rank()14return nothing15end1617# Initialize MPI data structures. This works for both the18# `TreeMesh` and the `P4estMesh` and is dimension-agnostic.19function init_mpi_data_structures(mpi_neighbor_interfaces, mpi_neighbor_mortars, n_dims,20nvars, n_nodes, uEltype)21data_size = nvars * n_nodes^(n_dims - 1)22n_small_elements = 2^(n_dims - 1)23mpi_send_buffers = Vector{Vector{uEltype}}(undef, length(mpi_neighbor_interfaces))24mpi_recv_buffers = Vector{Vector{uEltype}}(undef, length(mpi_neighbor_interfaces))25for index in 1:length(mpi_neighbor_interfaces)26mpi_send_buffers[index] = Vector{uEltype}(undef,27length(mpi_neighbor_interfaces[index]) *28data_size +29length(mpi_neighbor_mortars[index]) *30n_small_elements * 2 * data_size)31mpi_recv_buffers[index] = Vector{uEltype}(undef,32length(mpi_neighbor_interfaces[index]) *33data_size +34length(mpi_neighbor_mortars[index]) *35n_small_elements * 2 * data_size)36end3738mpi_send_requests = Vector{MPI.Request}(undef, length(mpi_neighbor_interfaces))39mpi_recv_requests = Vector{MPI.Request}(undef, length(mpi_neighbor_interfaces))4041return mpi_send_buffers, mpi_recv_buffers, mpi_send_requests, mpi_recv_requests42end43end # muladd444546