Skip to content

Commit

Permalink
Add SimpleWaveCaKernel generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
ianhinder committed Jan 24, 2012
1 parent c07b9c6 commit ec1a81c
Show file tree
Hide file tree
Showing 12 changed files with 369 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Examples/SimpleWaveCaKernel/cakernel.ccl
@@ -0,0 +1,21 @@
CCTK_CUDA_KERNEL initial_sine TYPE=gpu_cuda/3dblock STENCIL=0,0,0,0,0,0 TILE=16,16,16 SHARECODE=yes
{
CCTK_CUDA_KERNEL_VARIABLE cached=yes intent=out
{
phi
}
"phi"

CCTK_CUDA_KERNEL_VARIABLE cached=yes intent=out
{
pi
}
"pi"

CCTK_CUDA_KERNEL_VARIABLE cached=yes intent=in
{
x
}
"x"
}

6 changes: 6 additions & 0 deletions Examples/SimpleWaveCaKernel/configuration.ccl
@@ -0,0 +1,6 @@
# File produced by Kranc

REQUIRES GenericFD
OPTIONAL LoopControl
{
}
40 changes: 40 additions & 0 deletions Examples/SimpleWaveCaKernel/interface.ccl
@@ -0,0 +1,40 @@
# File produced by Kranc

implements: SimpleWaveCaKernel

inherits: Grid GenericFD Boundary



USES INCLUDE: GenericFD.h
USES INCLUDE: Symmetry.h
USES INCLUDE: sbp_calc_coeffs.h
USES INCLUDE: Boundary.h
USES INCLUDE: loopcontrol.h

CCTK_INT FUNCTION MoLRegisterEvolved(CCTK_INT IN EvolvedIndex, CCTK_INT IN RHSIndex)
USES FUNCTION MoLRegisterEvolved

SUBROUTINE Diff_coeff(CCTK_POINTER_TO_CONST IN cctkGH, CCTK_INT IN dir, CCTK_INT IN nsize, CCTK_INT OUT ARRAY imin, CCTK_INT OUT ARRAY imax, CCTK_REAL OUT ARRAY q, CCTK_INT IN table_handle)
USES FUNCTION Diff_coeff

CCTK_INT FUNCTION MultiPatch_GetMap(CCTK_POINTER_TO_CONST IN cctkGH)
USES FUNCTION MultiPatch_GetMap

CCTK_INT FUNCTION Boundary_SelectGroupForBC(CCTK_POINTER_TO_CONST IN GH, CCTK_INT IN faces, CCTK_INT IN boundary_width, CCTK_INT IN table_handle, CCTK_STRING IN group_name, CCTK_STRING IN bc_name)
USES FUNCTION Boundary_SelectGroupForBC

CCTK_INT FUNCTION Boundary_SelectVarForBC(CCTK_POINTER_TO_CONST IN GH, CCTK_INT IN faces, CCTK_INT IN boundary_width, CCTK_INT IN table_handle, CCTK_STRING IN var_name, CCTK_STRING IN bc_name)
USES FUNCTION Boundary_SelectVarForBC

public:
CCTK_REAL phi_g type=GF timelevels=1 tags=''
{
phi
} "phi_g"

public:
CCTK_REAL pi_g type=GF timelevels=1 tags=''
{
pi
} "pi_g"
60 changes: 60 additions & 0 deletions Examples/SimpleWaveCaKernel/param.ccl
@@ -0,0 +1,60 @@
# File produced by Kranc


shares: GenericFD



shares: MethodOfLines

USES CCTK_INT MoL_Num_Evolved_Vars
USES CCTK_INT MoL_Num_ArrayEvolved_Vars

restricted:
CCTK_INT verbose "verbose" STEERABLE=ALWAYS
{
*:* :: ""
} 0

restricted:
CCTK_INT SimpleWaveCaKernel_MaxNumEvolvedVars "Number of evolved variables used by this thorn" ACCUMULATOR-BASE=MethodofLines::MoL_Num_Evolved_Vars STEERABLE=RECOVER
{
0:0 :: "Number of evolved variables used by this thorn"
} 0

restricted:
CCTK_INT SimpleWaveCaKernel_MaxNumArrayEvolvedVars "Number of Array evolved variables used by this thorn" ACCUMULATOR-BASE=MethodofLines::MoL_Num_ArrayEvolved_Vars STEERABLE=RECOVER
{
0:0 :: "Number of Array evolved variables used by this thorn"
} 0

restricted:
CCTK_INT timelevels "Number of active timelevels" STEERABLE=RECOVER
{
0:3 :: ""
} 3

restricted:
CCTK_INT rhs_timelevels "Number of active RHS timelevels" STEERABLE=RECOVER
{
0:3 :: ""
} 1

restricted:
CCTK_INT other_timelevels "Number of active timelevels for non-evolved grid functions" STEERABLE=RECOVER
{
0:3 :: ""
} 1

restricted:
CCTK_INT initial_sine_calc_every "initial_sine_calc_every" STEERABLE=ALWAYS
{
*:* :: ""
} 1

restricted:
CCTK_INT initial_sine_calc_offset "initial_sine_calc_offset" STEERABLE=ALWAYS
{
*:* :: ""
} 0

52 changes: 52 additions & 0 deletions Examples/SimpleWaveCaKernel/schedule.ccl
@@ -0,0 +1,52 @@
# File produced by Kranc


if (other_timelevels == 1)
{
STORAGE: phi_g[1]
}

if (other_timelevels == 1)
{
STORAGE: pi_g[1]
}

schedule SimpleWaveCaKernel_Startup at STARTUP
{
LANG: C
OPTIONS: meta
} "create banner"

schedule SimpleWaveCaKernel_RegisterVars in MoL_Register
{
LANG: C
OPTIONS: meta
} "Register Variables for MoL"

schedule SimpleWaveCaKernel_RegisterSymmetries in SymmetryRegister
{
LANG: C
OPTIONS: meta
} "register symmetries"

schedule initial_sine AT INITIAL
{
LANG: C
} "initial_sine"

schedule SimpleWaveCaKernel_SelectBoundConds in MoL_PostStep
{
LANG: C
OPTIONS: level
} "select boundary conditions"

schedule SimpleWaveCaKernel_CheckBoundaries at BASEGRID
{
LANG: C
OPTIONS: meta
} "check boundaries treatment"

schedule group ApplyBCs as SimpleWaveCaKernel_ApplyBCs in MoL_PostStep after SimpleWaveCaKernel_SelectBoundConds
{
# no language specified
} "Apply boundary conditions controlled by thorn Boundary"
41 changes: 41 additions & 0 deletions Examples/SimpleWaveCaKernel/src/Boundaries.cc
@@ -0,0 +1,41 @@
/* File produced by Kranc */

#include "cctk.h"
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"
#include "cctk_Faces.h"
#include "util_Table.h"
#include "Symmetry.h"


/* the boundary treatment is split into 3 steps: */
/* 1. excision */
/* 2. symmetries */
/* 3. "other" boundary conditions, e.g. radiative */

/* to simplify scheduling and testing, the 3 steps */
/* are currently applied in separate functions */


extern "C" void SimpleWaveCaKernel_CheckBoundaries(CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS;
DECLARE_CCTK_PARAMETERS;

return;
}

extern "C" void SimpleWaveCaKernel_SelectBoundConds(CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS;
DECLARE_CCTK_PARAMETERS;

CCTK_INT ierr = 0;
return;
}



/* template for entries in parameter file:
*/

72 changes: 72 additions & 0 deletions Examples/SimpleWaveCaKernel/src/Differencing.h
@@ -0,0 +1,72 @@
#ifndef KRANC_DIFF_FUNCTIONS
# define PDstandard2nd1(u) ((-KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1o2dx)
#else
# define PDstandard2nd1(u) (PDstandard2nd1_impl(u,p1o2dx,cdj,cdk))
static CCTK_REAL PDstandard2nd1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dx, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
static CCTK_REAL PDstandard2nd1_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dx, ptrdiff_t const cdj, ptrdiff_t const cdk)
{
ptrdiff_t const cdi=sizeof(CCTK_REAL);
return (-KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1o2dx;
}
#endif

#ifndef KRANC_DIFF_FUNCTIONS
# define PDstandard2nd2(u) ((-KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1o2dy)
#else
# define PDstandard2nd2(u) (PDstandard2nd2_impl(u,p1o2dy,cdj,cdk))
static CCTK_REAL PDstandard2nd2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dy, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
static CCTK_REAL PDstandard2nd2_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dy, ptrdiff_t const cdj, ptrdiff_t const cdk)
{
ptrdiff_t const cdi=sizeof(CCTK_REAL);
return (-KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1o2dy;
}
#endif

#ifndef KRANC_DIFF_FUNCTIONS
# define PDstandard2nd3(u) ((-KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1))*p1o2dz)
#else
# define PDstandard2nd3(u) (PDstandard2nd3_impl(u,p1o2dz,cdj,cdk))
static CCTK_REAL PDstandard2nd3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dz, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
static CCTK_REAL PDstandard2nd3_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1o2dz, ptrdiff_t const cdj, ptrdiff_t const cdk)
{
ptrdiff_t const cdi=sizeof(CCTK_REAL);
return (-KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1))*p1o2dz;
}
#endif

#ifndef KRANC_DIFF_FUNCTIONS
# define PDstandard2nd11(u) ((-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1odx2)
#else
# define PDstandard2nd11(u) (PDstandard2nd11_impl(u,p1odx2,cdj,cdk))
static CCTK_REAL PDstandard2nd11_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odx2, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
static CCTK_REAL PDstandard2nd11_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odx2, ptrdiff_t const cdj, ptrdiff_t const cdk)
{
ptrdiff_t const cdi=sizeof(CCTK_REAL);
return (-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,-1,0,0) + KRANC_GFOFFSET3D(u,1,0,0))*p1odx2;
}
#endif

#ifndef KRANC_DIFF_FUNCTIONS
# define PDstandard2nd22(u) ((-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1ody2)
#else
# define PDstandard2nd22(u) (PDstandard2nd22_impl(u,p1ody2,cdj,cdk))
static CCTK_REAL PDstandard2nd22_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1ody2, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
static CCTK_REAL PDstandard2nd22_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1ody2, ptrdiff_t const cdj, ptrdiff_t const cdk)
{
ptrdiff_t const cdi=sizeof(CCTK_REAL);
return (-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,-1,0) + KRANC_GFOFFSET3D(u,0,1,0))*p1ody2;
}
#endif

#ifndef KRANC_DIFF_FUNCTIONS
# define PDstandard2nd33(u) ((-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1))*p1odz2)
#else
# define PDstandard2nd33(u) (PDstandard2nd33_impl(u,p1odz2,cdj,cdk))
static CCTK_REAL PDstandard2nd33_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odz2, ptrdiff_t const cdj, ptrdiff_t const cdk) CCTK_ATTRIBUTE_NOINLINE CCTK_ATTRIBUTE_UNUSED;
static CCTK_REAL PDstandard2nd33_impl(CCTK_REAL const* restrict const u, CCTK_REAL const p1odz2, ptrdiff_t const cdj, ptrdiff_t const cdk)
{
ptrdiff_t const cdi=sizeof(CCTK_REAL);
return (-2*KRANC_GFOFFSET3D(u,0,0,0) + KRANC_GFOFFSET3D(u,0,0,-1) + KRANC_GFOFFSET3D(u,0,0,1))*p1odz2;
}
#endif

18 changes: 18 additions & 0 deletions Examples/SimpleWaveCaKernel/src/RegisterMoL.cc
@@ -0,0 +1,18 @@
/* File produced by Kranc */

#include "cctk.h"
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"

extern "C" void SimpleWaveCaKernel_RegisterVars(CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS;
DECLARE_CCTK_PARAMETERS;

CCTK_INT ierr = 0;

/* Register all the evolved grid functions with MoL */

/* Register all the evolved Array functions with MoL */
return;
}
29 changes: 29 additions & 0 deletions Examples/SimpleWaveCaKernel/src/RegisterSymmetries.cc
@@ -0,0 +1,29 @@
/* File produced by Kranc */

#include "cctk.h"
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"
#include "Symmetry.h"

extern "C" void SimpleWaveCaKernel_RegisterSymmetries(CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS;
DECLARE_CCTK_PARAMETERS;


/* array holding symmetry definitions */
CCTK_INT sym[3];


/* Register symmetries of grid functions */
sym[0] = 1;
sym[1] = 1;
sym[2] = 1;
SetCartSymVN(cctkGH, sym, "SimpleWaveCaKernel::phi");

sym[0] = 1;
sym[1] = 1;
sym[2] = 1;
SetCartSymVN(cctkGH, sym, "SimpleWaveCaKernel::pi");

}
10 changes: 10 additions & 0 deletions Examples/SimpleWaveCaKernel/src/Startup.cc
@@ -0,0 +1,10 @@
/* File produced by Kranc */

#include "cctk.h"

extern "C" int SimpleWaveCaKernel_Startup(void)
{
const char * banner = "SimpleWaveCaKernel";
CCTK_RegisterBanner(banner);
return 0;
}
17 changes: 17 additions & 0 deletions Examples/SimpleWaveCaKernel/src/initial_sine.code
@@ -0,0 +1,17 @@
CAKERNEL_initial_sine_Declare_Begin_s
CAKERNEL_initial_sine_Declare_Cached_Variables_s
CAKERNEL_initial_sine_Declare_Flow_Variables_s
CAKERNEL_initial_sine_Limit_Threads_To_LSH_Begin_s
CAKERNEL_initial_sine_Fetch_Data_To_Cache_s
CAKERNEL_initial_sine_Computations_Begin_s
CAKERNEL_initial_sine_Iterate_Local_Tile_s
CAKERNEL_initial_sine_Fetch_Front_Tile_To_Cache_s
CAKERNEL_initial_sine_Limit_Threads_To_Compute_Begin_s
// Kernel code
CAKERNEL_initial_sine_Limit_Threads_To_Compute_End_s

CAKERNEL_initial_sine_Computations_End_s

CAKERNEL_initial_sine_Limit_Threads_To_LSH_End_s

CAKERNEL_initial_sine_Declare_End_s
3 changes: 3 additions & 0 deletions Examples/SimpleWaveCaKernel/src/make.code.defn
@@ -0,0 +1,3 @@
# File produced by Kranc

SRCS = Startup.cc RegisterMoL.cc RegisterSymmetries.cc Boundaries.cc

0 comments on commit ec1a81c

Please sign in to comment.