diff options
| author | Tor Aamodt <[email protected]> | 2010-07-15 18:09:46 -0800 |
|---|---|---|
| committer | Tor Aamodt <[email protected]> | 2010-07-15 18:09:46 -0800 |
| commit | 69f2911e04ffb1b19eef1fafb8c040af271f656e (patch) | |
| tree | 231d3b6bdc3a202f7c255bfcf7bf2c36e32cee9e /benchmarks/CUDA/DG/src/MaxwellsRun3d.c | |
creating branch for adding support for CUDA 3.x and Fermi
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 6829]
Diffstat (limited to 'benchmarks/CUDA/DG/src/MaxwellsRun3d.c')
| -rw-r--r-- | benchmarks/CUDA/DG/src/MaxwellsRun3d.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/benchmarks/CUDA/DG/src/MaxwellsRun3d.c b/benchmarks/CUDA/DG/src/MaxwellsRun3d.c new file mode 100644 index 0000000..d4ee9f9 --- /dev/null +++ b/benchmarks/CUDA/DG/src/MaxwellsRun3d.c @@ -0,0 +1,60 @@ +#include "mpi.h" +#include "fem.h" + +void MaxwellsRun3d(Mesh *mesh, double FinalTime, double dt){ + + double time = 0; + int INTRK, tstep=0; + + double mpitime0 = MPI_Wtime(); + MPI_Barrier(MPI_COMM_WORLD); + + dt = 0.001; + + /* outer time step loop */ + while (time<FinalTime){ + + /* adjust final step to end exactly at FinalTime */ + if (time+dt > FinalTime) { dt = FinalTime-time; } + + for (INTRK=1; INTRK<=5; ++INTRK) { + + /* compute rhs of TM-mode MaxwellsGPU's equations */ + const float fdt = dt; + const float fa = (float)mesh->rk4a[INTRK-1]; + const float fb = (float)mesh->rk4b[INTRK-1]; + +#ifdef CUDA + MaxwellsKernel3d(mesh, fa, fb, fdt); +#else + MaxwellsRHS3d(mesh, fa, fb, fdt); +#endif + } + + time += dt; /* increment current time */ + tstep++; /* increment timestep */ + } + +#ifdef CUDA + cudaThreadSynchronize(); +#endif + + double flopsV = p_Np*p_Np*36 + p_Np*66; /* V3 */ + double flopsS = p_Nfp*p_Nfaces*(15 + 10 + 36) + p_Np*(p_Nfaces*p_Nfp*12 + 6); + double flopsR = p_Np*p_Nfields*4; + + int Kloc = mesh->K; + + double mpitime1 = MPI_Wtime(); + + double time_total = mpitime1-mpitime0; + + MPI_Barrier(MPI_COMM_WORLD); + printf("%d %d %lg %lg proc, N, time taken, GFLOPS/s (GPU)\n", + mesh->procid, + p_N, + time_total, + 5*(tstep)*( (flopsV+flopsS+flopsR)*((double)Kloc/(1.e9*time_total)))); + + +} |
