MP-Gadget
5.0.1.dev1-76bc7d4726-dirty
|
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "types.h"
#include "petapm.h"
#include "utils.h"
#include "walltime.h"
Go to the source code of this file.
Classes | |
struct | Pencil |
Macros | |
#define | POS(i) ((double*) (&((char*)CPS->Parts)[CPS->elsize * (i) + CPS->offset_pos])) |
#define | MASS(i) ((float*) (&((char*)CPS->Parts)[CPS->elsize * (i) + CPS->offset_mass])) |
#define | INACTIVE(i) (CPS->active && !CPS->active(i)) |
#define | ROLL(a, N, j) |
Typedefs | |
typedef void(* | cell_iterator) (double *cell_value, double *comm_buffer) |
typedef void(* | pm_iterator) (PetaPM *pm, int i, double *mesh, double weight) |
Functions | |
static void | layout_prepare (PetaPM *pm, struct Layout *L, double *meshbuf, PetaPMRegion *regions, const int Nregions, MPI_Comm comm) |
static void | layout_finish (struct Layout *L) |
static void | layout_build_and_exchange_cells_to_pfft (PetaPM *pm, struct Layout *L, double *meshbuf, double *real) |
static void | layout_build_and_exchange_cells_to_local (PetaPM *pm, struct Layout *L, double *meshbuf, double *real) |
static void | layout_iterate_cells (PetaPM *pm, struct Layout *L, cell_iterator iter, double *real) |
static int | pencil_cmp_target (const void *v1, const void *v2) |
static int | pos_get_target (PetaPM *pm, const int pos[2]) |
static int64_t | reduce_int64 (int64_t input, MPI_Comm comm) |
pfft_complex * | petapm_alloc_rhok (PetaPM *pm) |
static void | pm_init_regions (PetaPM *pm, PetaPMRegion *regions, const int Nregions) |
PetaPMRegion * | petapm_get_fourier_region (PetaPM *pm) |
PetaPMRegion * | petapm_get_real_region (PetaPM *pm) |
int | petapm_mesh_to_k (PetaPM *pm, int i) |
int * | petapm_get_thistask2d (PetaPM *pm) |
int * | petapm_get_ntask2d (PetaPM *pm) |
void | petapm_module_init (int Nthreads) |
void | petapm_init (PetaPM *pm, double BoxSize, double Asmth, int Nmesh, double G, MPI_Comm comm) |
void | petapm_destroy (PetaPM *pm) |
static void | pm_iterate (PetaPM *pm, pm_iterator iterator, PetaPMRegion *regions, const int Nregions) |
static void | pm_apply_transfer_function (PetaPM *pm, pfft_complex *src, pfft_complex *dst, petapm_transfer_func H) |
static void | put_particle_to_mesh (PetaPM *pm, int i, double *mesh, double weight) |
PetaPMRegion * | petapm_force_init (PetaPM *pm, petapm_prepare_func prepare, PetaPMParticleStruct *pstruct, int *Nregions, void *userdata) |
pfft_complex * | petapm_force_r2c (PetaPM *pm, PetaPMGlobalFunctions *global_functions) |
void | petapm_force_c2r (PetaPM *pm, pfft_complex *rho_k, PetaPMRegion *regions, const int Nregions, PetaPMFunctions *functions) |
void | petapm_force_finish (PetaPM *pm) |
void | petapm_force (PetaPM *pm, petapm_prepare_func prepare, PetaPMGlobalFunctions *global_functions, PetaPMFunctions *functions, PetaPMParticleStruct *pstruct, void *userdata) |
static void | layout_build_pencils (PetaPM *pm, struct Layout *L, double *meshbuf, PetaPMRegion *regions, const int Nregions) |
static void | layout_exchange_pencils (struct Layout *L) |
static void | to_pfft (double *cell, double *buf) |
static void | to_region (double *cell, double *region) |
static void | pm_iterate_one (PetaPM *pm, int i, pm_iterator iterator, PetaPMRegion *regions, const int Nregions) |
void | petapm_region_init_strides (PetaPMRegion *region) |
Variables | |
static MPI_Datatype | MPI_PENCIL |
static PetaPMParticleStruct * | CPS |
#define ROLL | ( | a, | |
N, | |||
j | |||
) |
typedef void(* cell_iterator) (double *cell_value, double *comm_buffer) |
typedef void(* pm_iterator) (PetaPM *pm, int i, double *mesh, double weight) |
|
static |
Definition at line 639 of file petapm.c.
References Layout::BufRecv, Layout::BufSend, Layout::comm, Layout::DcRecv, Layout::DcSend, layout_iterate_cells(), Pencil::len, Pencil::meshbuf_first, myfree, mymalloc, Layout::NcExport, Layout::NcImport, Layout::NcRecv, Layout::NcSend, Layout::NpExport, Pencil::offset, Layout::PencilSend, and to_region().
Referenced by petapm_force_c2r().
|
static |
Definition at line 583 of file petapm.c.
References Layout::BufRecv, Layout::BufSend, Layout::comm, Layout::DcRecv, Layout::DcSend, layout_iterate_cells(), Pencil::len, Pencil::meshbuf_first, message(), myfree, mymalloc, Layout::NcExport, Layout::NcImport, Layout::NcRecv, Layout::NcSend, Layout::NpExport, Pencil::offset, Layout::PencilSend, and to_pfft().
Referenced by petapm_force_r2c().
|
static |
Definition at line 479 of file petapm.c.
References Region::buffer, Pencil::len, Pencil::meshbuf_first, Pencil::offset, Region::offset, Layout::PencilSend, pos_get_target(), Region::size, and Pencil::task.
Referenced by layout_prepare().
|
static |
Definition at line 522 of file petapm.c.
References Layout::comm, Layout::DcRecv, Layout::DcSend, Layout::DpRecv, Layout::DpSend, Pencil::first, Pencil::len, MPI_PENCIL, Layout::NpRecv, Layout::NpSend, NTask, Pencil::offset, Layout::PencilRecv, and Layout::PencilSend.
Referenced by layout_prepare().
|
static |
Definition at line 569 of file petapm.c.
References Layout::ibuffer, myfree, Layout::PencilRecv, and Layout::PencilSend.
Referenced by petapm_force_finish().
|
static |
Definition at line 682 of file petapm.c.
References Layout::BufRecv, endrun(), Pencil::first, Pencil::len, PetaPM::Nmesh, Layout::NpImport, Pencil::offset, Region::offset, Layout::PencilRecv, PetaPM::real_space_region, Region::size, and Region::strides.
Referenced by layout_build_and_exchange_cells_to_local(), and layout_build_and_exchange_cells_to_pfft().
|
static |
Definition at line 375 of file petapm.c.
References Layout::comm, Layout::DcRecv, Layout::DcSend, Layout::DpRecv, Layout::DpSend, endrun(), Layout::ibuffer, layout_build_pencils(), layout_exchange_pencils(), Pencil::len, message(), mymalloc, Layout::NcExport, Layout::NcImport, Layout::NcRecv, Layout::NcSend, Layout::NpExport, Layout::NpImport, Layout::NpRecv, Layout::NpSend, NTask, pencil_cmp_target(), Layout::PencilRecv, Layout::PencilSend, qsort_openmp, reduce_int64(), Region::size, and Pencil::task.
Referenced by petapm_force_init().
|
static |
Definition at line 837 of file petapm.c.
References Pencil::len, Pencil::meshbuf_first, and Pencil::task.
Referenced by layout_prepare().
pfft_complex* petapm_alloc_rhok | ( | PetaPM * | pm | ) |
Definition at line 50 of file petapm.c.
References PetaPMPriv::fftsize, mymalloc, and PetaPM::priv.
Referenced by displacement_fields().
void petapm_destroy | ( | PetaPM * | pm | ) |
Definition at line 215 of file petapm.c.
References PetaPMPriv::comm_cart_2d, PetaPM::Mesh2Task, myfree, PetaPMPriv::plan_back, PetaPMPriv::plan_forw, and PetaPM::priv.
Referenced by do_force_test(), main(), and run_gravity_test().
void petapm_force | ( | PetaPM * | pm, |
petapm_prepare_func | prepare, | ||
PetaPMGlobalFunctions * | global_functions, | ||
PetaPMFunctions * | functions, | ||
PetaPMParticleStruct * | pstruct, | ||
void * | userdata | ||
) |
Definition at line 353 of file petapm.c.
References CPS, functions, global_functions, myfree, petapm_force_c2r(), petapm_force_finish(), petapm_force_init(), petapm_force_r2c(), and PetaPMParticleStruct::RegionInd.
Referenced by glass_force(), and gravpm_force().
void petapm_force_c2r | ( | PetaPM * | pm, |
pfft_complex * | rho_k, | ||
PetaPMRegion * | regions, | ||
const int | Nregions, | ||
PetaPMFunctions * | functions | ||
) |
Definition at line 317 of file petapm.c.
References PetaPMPriv::fftsize, functions, PetaPMPriv::layout, layout_build_and_exchange_cells_to_local(), PetaPMPriv::meshbuf, myfree, mymalloc, mymalloc2, PetaPMFunctions::name, PetaPMPriv::plan_back, pm_apply_transfer_function(), pm_iterate(), PetaPM::priv, PetaPMFunctions::readout, PetaPMFunctions::transfer, and walltime_measure.
Referenced by displacement_fields(), and petapm_force().
void petapm_force_finish | ( | PetaPM * | pm | ) |
Definition at line 348 of file petapm.c.
References PetaPMPriv::layout, layout_finish(), PetaPMPriv::meshbuf, myfree, and PetaPM::priv.
Referenced by displacement_fields(), and petapm_force().
PetaPMRegion* petapm_force_init | ( | PetaPM * | pm, |
petapm_prepare_func | prepare, | ||
PetaPMParticleStruct * | pstruct, | ||
int * | Nregions, | ||
void * | userdata | ||
) |
Definition at line 251 of file petapm.c.
References PetaPM::comm, CPS, PetaPMPriv::layout, layout_prepare(), PetaPMPriv::meshbuf, pm_init_regions(), pm_iterate(), PetaPM::priv, put_particle_to_mesh(), and walltime_measure.
Referenced by displacement_fields(), and petapm_force().
pfft_complex* petapm_force_r2c | ( | PetaPM * | pm, |
PetaPMGlobalFunctions * | global_functions | ||
) |
Definition at line 273 of file petapm.c.
References PetaPMPriv::fftsize, PetaPMGlobalFunctions::global_analysis, global_functions, PetaPMGlobalFunctions::global_readout, PetaPMGlobalFunctions::global_transfer, PetaPMPriv::layout, layout_build_and_exchange_cells_to_pfft(), PetaPMPriv::meshbuf, PetaPMPriv::meshbufsize, myfree, mymalloc, mymalloc2, PetaPMPriv::plan_forw, pm_apply_transfer_function(), PetaPM::priv, report_memory_usage, and walltime_measure.
Referenced by petapm_force().
PetaPMRegion* petapm_get_fourier_region | ( | PetaPM * | pm | ) |
Definition at line 64 of file petapm.c.
References PetaPM::fourier_space_region.
Referenced by displacement_fields().
int* petapm_get_ntask2d | ( | PetaPM * | pm | ) |
Definition at line 77 of file petapm.c.
References PetaPM::NTask2d.
Referenced by idgen_init().
PetaPMRegion* petapm_get_real_region | ( | PetaPM * | pm | ) |
Definition at line 67 of file petapm.c.
References PetaPM::real_space_region.
int* petapm_get_thistask2d | ( | PetaPM * | pm | ) |
Definition at line 74 of file petapm.c.
References PetaPM::ThisTask2d.
Referenced by idgen_init().
void petapm_init | ( | PetaPM * | pm, |
double | BoxSize, | ||
double | Asmth, | ||
int | Nmesh, | ||
double | G, | ||
MPI_Comm | comm | ||
) |
Definition at line 94 of file petapm.c.
References PetaPM::Asmth, PetaPM::BoxSize, PetaPM::CellSize, PetaPM::comm, PetaPMPriv::comm_cart_2d, endrun(), PetaPMPriv::fftsize, PetaPM::fourier_space_region, PetaPM::G, G, PetaPM::Mesh2Task, message(), myfree, mymalloc, mymalloc2, PetaPM::Nmesh, NTask, PetaPM::NTask2d, Region::offset, petapm_region_init_strides(), PetaPMPriv::plan_back, PetaPMPriv::plan_forw, PetaPM::priv, PetaPM::real_space_region, ROLL, Region::size, ThisTask, and PetaPM::ThisTask2d.
Referenced by gravpm_init_periodic(), and main().
int petapm_mesh_to_k | ( | PetaPM * | pm, |
int | i | ||
) |
Definition at line 70 of file petapm.c.
References PetaPM::Nmesh.
Referenced by pm_apply_transfer_function().
void petapm_module_init | ( | int | Nthreads | ) |
Definition at line 82 of file petapm.c.
References MPI_PENCIL.
Referenced by begrun(), main(), and setup_tree().
void petapm_region_init_strides | ( | PetaPMRegion * | region | ) |
Definition at line 813 of file petapm.c.
References Region::buffer, Region::size, Region::strides, and Region::totalsize.
Referenced by _prepare(), convert_node_to_region(), makeregion(), and petapm_init().
|
static |
Definition at line 883 of file petapm.c.
References endrun(), PetaPM::fourier_space_region, PetaPM::Nmesh, Region::offset, petapm_mesh_to_k(), Region::strides, and Region::totalsize.
Referenced by petapm_force_c2r(), and petapm_force_r2c().
|
static |
Definition at line 723 of file petapm.c.
References Region::buffer, PetaPMPriv::meshbuf, PetaPMPriv::meshbufsize, mymalloc, PetaPM::priv, and Region::totalsize.
Referenced by petapm_force_init().
|
static |
Definition at line 804 of file petapm.c.
References PetaPM::comm, CPS, MPIU_Barrier, PetaPMParticleStruct::NumPart, and pm_iterate_one().
Referenced by petapm_force_c2r(), and petapm_force_init().
|
static |
Definition at line 746 of file petapm.c.
References Region::buffer, PetaPM::CellSize, CPS, endrun(), Pencil::offset, Region::offset, POS, PetaPMParticleStruct::RegionInd, Region::size, Region::strides, and Region::totalsize.
Referenced by pm_iterate().
|
static |
Definition at line 824 of file petapm.c.
References PetaPMPriv::comm_cart_2d, PetaPM::Mesh2Task, PetaPM::Nmesh, and PetaPM::priv.
Referenced by layout_build_pencils().
|
static |
Definition at line 929 of file petapm.c.
References INACTIVE, and MASS.
Referenced by petapm_force_init().
|
static |
Definition at line 936 of file petapm.c.
References MPI_INT64.
Referenced by layout_prepare().
|
static |
Definition at line 577 of file petapm.c.
Referenced by layout_build_and_exchange_cells_to_pfft().
|
static |
Definition at line 634 of file petapm.c.
Referenced by layout_build_and_exchange_cells_to_local().
|
static |
Definition at line 59 of file petapm.c.
Referenced by petapm_force(), petapm_force_init(), pm_iterate(), and pm_iterate_one().
|
static |
Definition at line 46 of file petapm.c.
Referenced by layout_exchange_pencils(), and petapm_module_init().