From 69f2911e04ffb1b19eef1fafb8c040af271f656e Mon Sep 17 00:00:00 2001 From: Tor Aamodt Date: Thu, 15 Jul 2010 18:09:46 -0800 Subject: creating branch for adding support for CUDA 3.x and Fermi [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 6829] --- benchmarks/CUDA/DG/src/MaxwellsRHS3d.c | 220 +++++++++++++++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 benchmarks/CUDA/DG/src/MaxwellsRHS3d.c (limited to 'benchmarks/CUDA/DG/src/MaxwellsRHS3d.c') diff --git a/benchmarks/CUDA/DG/src/MaxwellsRHS3d.c b/benchmarks/CUDA/DG/src/MaxwellsRHS3d.c new file mode 100644 index 0000000..13ed5bf --- /dev/null +++ b/benchmarks/CUDA/DG/src/MaxwellsRHS3d.c @@ -0,0 +1,220 @@ +#include "mpi.h" +#include "fem.h" + +void MaxwellsRHS3d(Mesh *mesh, float frka, float frkb, float fdt){ + + /* registers and temporary */ + register unsigned int k, n; + + /* mesh parameters */ + const int K = mesh->K; + + float *vgeo = mesh->vgeo; + float *surfinfo = mesh->surfinfo; + float *f_Dr = mesh->f_Dr; + float *f_Ds = mesh->f_Ds; + float *f_Dt = mesh->f_Dt; + float *f_LIFT = mesh->f_LIFT; + + float *f_Q = mesh->f_Q; + float *f_rhsQ = mesh->f_rhsQ; + float *f_resQ = mesh->f_resQ; + + float *f_inQ = mesh->f_inQ; + float *f_outQ = mesh->f_outQ; + + int p; + + /* mpi request buffer */ + MPI_Request *mpi_out_requests = (MPI_Request*) calloc(mesh->nprocs, sizeof(MPI_Request)); + MPI_Request *mpi_in_requests = (MPI_Request*) calloc(mesh->nprocs, sizeof(MPI_Request)); + + /* buffer outgoing node data */ + for(n=0;nparNtotalout;++n) + mesh->f_outQ[n] = f_Q[mesh->parmapOUT[n]]; + + /* do sends */ + int sk = 0, Nmess = 0; + for(p=0;pnprocs;++p){ + if(p!=mesh->procid){ + int Nout = mesh->Npar[p]*p_Nfields*p_Nfp; + if(Nout){ + /* symmetric communications (different ordering) */ + MPI_Isend(f_outQ+sk, Nout, MPI_FLOAT, p, 6666+p, MPI_COMM_WORLD, mpi_out_requests +Nmess); + MPI_Irecv(f_inQ+sk, Nout, MPI_FLOAT, p, 6666+mesh->procid, MPI_COMM_WORLD, mpi_in_requests +Nmess); + sk+=Nout; + ++Nmess; + } + } + } + + for(k=0;knprocs, sizeof(MPI_Status)); + MPI_Waitall(Nmess, mpi_in_requests, instatus); + free(instatus); + + for(k=0;knprocs, sizeof(MPI_Status)); + MPI_Waitall(Nmess, mpi_out_requests, outstatus); + free(outstatus); + + +} + -- cgit v1.3