Skip to content

Commit

Permalink
converted keyword from Liszt to Ebb
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbo committed Oct 2, 2015
1 parent 3bb4635 commit 70e44f1
Show file tree
Hide file tree
Showing 148 changed files with 1,187 additions and 1,123 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Expand Up @@ -21,8 +21,8 @@ local_files

simple_trimesh_diffusion_output
vega_output
liszt_output
liszt_fem_output
ebb_output
ebb_fem_output
vegamodels/

notes.txt
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
@@ -1,5 +1,5 @@
===============================================================================
Terra Release License
Liszt-Ebb Release License
===============================================================================
MIT License

Expand Down
16 changes: 8 additions & 8 deletions Makefile
Expand Up @@ -177,18 +177,18 @@ build/%.o: src_interpreter/%.cpp terra
mkdir -p build
$(CXX) $(FLAGS) $(CPPFLAGS) $< -c -o $@

release/bin/$(EXECUTABLE): $(addprefix build/, $(EXEC_OBJS)) terra
mkdir -p release/bin
bin/$(EXECUTABLE): $(addprefix build/, $(EXEC_OBJS)) terra
mkdir -p bin
$(CXX) $(addprefix build/, $(EXEC_OBJS)) -o $@ $(LFLAGS)

$(EXECUTABLE): release/bin/$(EXECUTABLE)
ln -s release/bin/$(EXECUTABLE) $(EXECUTABLE)
$(EXECUTABLE): bin/$(EXECUTABLE)
ln -sf bin/$(EXECUTABLE) $(EXECUTABLE)

release/bin/$(EXECUTABLE_CP): release/bin/$(EXECUTABLE)
ln -s release/bin/$(EXECUTABLE) release/bin/$(EXECUTABLE_CP)
bin/$(EXECUTABLE_CP): bin/$(EXECUTABLE)
ln -sf bin/$(EXECUTABLE) bin/$(EXECUTABLE_CP)

$(EXECUTABLE_CP): release/bin/$(EXECUTABLE)
ln -s release/bin/$(EXECUTABLE) $(EXECUTABLE_CP)
$(EXECUTABLE_CP): bin/$(EXECUTABLE)
ln -sf bin/$(EXECUTABLE) $(EXECUTABLE_CP)

# # ----------------------------------------------------------------------- # #
# Legion Rules
Expand Down
84 changes: 73 additions & 11 deletions README.md
@@ -1,14 +1,76 @@
This project is a port of the Liszt DSL, which was originally embedded in Scala, to the Lua/Terra system, with the following (planned) extensions:
- implicit method support (both sparse matrix encoding and an interface to external solver libraries)
- particles

The following extensions have already been implemented:
- mesh data is stored on a generic OP2-like graph structure that allows us to represent mesh topology, fields and sparse matrices with the same data structure.
# Liszt-Ebb

Ebb is a (domain-specific) language for writing physical simulations. It is part of the Liszt project at Stanford.

## Quick Setup

Once you've got your local copy of this repository, you can simply type

```
make
```

and Terra (dependency) will be downloaded for you. When this process is done, you can type

```
./runtests
```

to make sure everything is working. You should be good to go.


### Troubleshooting Quick Setup

If you don't have wget or unzip installed, you may run into trouble with the automatic download of Terra. Please install those tools or try installing Terra yourself.

(You may also run into trouble if you don't have libcurses and libz installed. If this is the case, please report back to the developers---we currently don't believe this will ever happen.)



## Longer Setup Instructions

If you are working on multiple DSLs using Terra and want to avoid a redundant Terra install, you can configure the variable `TERRA_DIR` at the top of the [`Makefile`](Makefile) to locate your Terra install directory instead. If you have a binary download, simply point `TERRA_DIR` variable at the root directory. If you are building Terra from source, then point `TERRA_DIR` at the `release` subdirectory. By default, `TERRA_DIR=../terra/release`.


### Legion Setup

If you need to run Ebb on Legion, then please contact the developers directly. The feature is currently under development.



## More Details

See the [full manual](docs/manual.md) for more information.

## Examples

See the [examples](examples) directory for example Ebb programs. This is a good way to get a few ideas about how to proceed once you've got some code running.

## Tests

As mentioned before, you can run the testing suite by executing
```
./run_tests
```



## Running Ebb on the GPU

To run an Ebb program on the GPU instead of CPU, simply add the command line flag.

```
ebb -g my_program.t
```

Support for simultaneous CPU/GPU use is currently being worked on. Please contact the developers if the feature is particularly important for you.








The original project is hosted at http://liszt.stanford.edu.

Directory structure:
compiler/ - liszt compiler implementation
examples/ - example liszt programs, and terra applications that use the liszt runtime
runtime/ - C++ liszt runtime interface used by the compiler
spec/ - contains example programs written in the Scala version of Liszt, paired with their Liszt-in-Terra equivalents.
4 changes: 2 additions & 2 deletions release/ebb/domains/lmesh.t → deprecated/domains/lmesh.t
Expand Up @@ -97,7 +97,7 @@ function initFieldFromIndex(rel,name, key, row_idx)
end

local function initMeshRelations(mesh)
import "ebb.src.liszt"
import "ebb"
-- initialize list of relations
local relations = {}
-- basic element relations
Expand Down Expand Up @@ -152,7 +152,7 @@ local function initMeshRelations(mesh)
end
--setup the correct macros
relations[xtoy.t1]:NewFieldMacro(xtoy.t2,L.NewMacro(function(f)
return liszt `L.Where(rel.[xtoy.n1],f).[xtoy.n2]
return ebb `L.Where(rel.[xtoy.n1],f).[xtoy.n2]
end))
end

Expand Down
2 changes: 1 addition & 1 deletion deprecated/tests/mesh.t
@@ -1,6 +1,6 @@
--DISABLE-TEST
--DISABLE-ON-LEGION
import "ebb.liszt"
import "ebb"

local LMesh = require "ebb.domains.lmesh"
local M = LMesh.Load("examples/mesh.lmesh")
Expand Down
48 changes: 24 additions & 24 deletions devapps/benchmarks/3d_stable_fluids.t
@@ -1,4 +1,4 @@
import "ebb.liszt"
import "ebb"
--L.default_processor = L.GPU

local Grid = require 'ebb.domains.grid'
Expand Down Expand Up @@ -51,7 +51,7 @@ grid.cells:NewField('velocity_prev', L.vec3f):Load({0,0,0})

grid.cells:NewField('vel_shadow', L.vec3f):Load({0,0,0})

local liszt neumann_shadow_update (c : grid.cells)
local ebb neumann_shadow_update (c : grid.cells)
if c.xneg_depth > 0 then
var v = c(1,0,0).velocity
c.vel_shadow = { -v[0], v[1], v[2] }
Expand All @@ -72,7 +72,7 @@ local liszt neumann_shadow_update (c : grid.cells)
c.vel_shadow = { v[0], v[1], -v[2] }
end
end
local liszt neumann_cpy_update (c : grid.cells)
local ebb neumann_cpy_update (c : grid.cells)
c.velocity = c.vel_shadow
end
local function vel_neumann_bnd(cells)
Expand All @@ -89,7 +89,7 @@ local diffuse_diagonal = L.Global(L.float, 0.0)
local diffuse_edge = L.Global(L.float, 0.0)

-- One Jacobi-Iteration
local liszt diffuse_lin_solve_jacobi_step (c : grid.cells)
local ebb diffuse_lin_solve_jacobi_step (c : grid.cells)
var edge_sum = diffuse_edge * ( c(-1,0,0).velocity + c(1,0,0).velocity +
c(0,-1,0).velocity + c(0,1,0).velocity +
c(0,0,-1).velocity + c(0,0,1).velocity )
Expand Down Expand Up @@ -142,21 +142,21 @@ local min_y = grid:yOrigin() + ycwidth/2 + epsilon
local max_y = grid:yOrigin() + grid:yWidth() - ycwidth/2 - epsilon
local min_z = grid:zOrigin() + zcwidth/2 + epsilon
local max_z = grid:zOrigin() + grid:zWidth() - zcwidth/2 - epsilon
local liszt wrap(val, lower, upper)
local ebb wrap(val, lower, upper)
var diff : L.float = upper - lower
var temp = L.float(cmath.fmod(val - lower, diff))
if temp < 0 then
temp += diff
end
return temp + lower
end
local liszt clamp(val, lower, upper)
local ebb clamp(val, lower, upper)
var result : L.float = val
result max= L.float(lower)
result min= L.float(upper)
return result
end
local snap_to_grid = liszt(p)
local snap_to_grid = ebb(p)
var pxyz : L.vec3f = p
pxyz[0] = clamp(pxyz[0], min_x, max_x)
pxyz[1] = clamp(pxyz[1], min_y, max_y)
Expand All @@ -170,7 +170,7 @@ if PERIODIC then
max_y = grid:yOrigin() + grid:yWidth()
min_z = grid:zOrigin()
max_z = grid:zOrigin() + grid:zWidth()
snap_to_grid = liszt(p)
snap_to_grid = ebb(p)
var pxyz : L.vec3f = p
pxyz[0] = wrap(pxyz[0], min_x, max_x)
pxyz[1] = wrap(pxyz[1], min_y, max_y)
Expand All @@ -179,17 +179,17 @@ if PERIODIC then
end
end

local liszt advect_where_from (c : grid.cells)
local ebb advect_where_from (c : grid.cells)
var offset = - c.velocity_prev
-- Make sure all our lookups are appropriately confined
c.lookup_pos = snap_to_grid(c.center + advect_dt * offset)
end

local liszt advect_point_locate (c : grid.cells)
local ebb advect_point_locate (c : grid.cells)
c.lookup_from = grid.dual_locate(c.lookup_pos)
end

local liszt advect_interpolate_velocity (c : grid.cells)
local ebb advect_interpolate_velocity (c : grid.cells)
var dc = c.lookup_from

-- figure out fractional position in the dual cell in range [0.0, 1.0]
Expand Down Expand Up @@ -245,15 +245,15 @@ grid.cells:NewField('divergence', L.float):Load(0)
grid.cells:NewField('p', L.float):Load(0)
grid.cells:NewField('p_temp', L.float):Load(0)

local liszt project_lin_solve_jacobi_step (c : grid.cells)
local ebb project_lin_solve_jacobi_step (c : grid.cells)
var edge_sum = project_edge * ( c(-1,0,0).p + c(1,0,0).p +
c(0,-1,0).p + c(0,1,0).p +
c(0,0,-1).p + c(0,0,1).p )
c.p_temp = (c.divergence - edge_sum) / project_diagonal
end

-- Neumann condition
local liszt pressure_shadow_update (c : grid.cells)
local ebb pressure_shadow_update (c : grid.cells)
if c.xneg_depth > 0 then
c.p_temp = c(1,0,0).p
elseif c.xpos_depth > 0 then
Expand All @@ -268,7 +268,7 @@ local liszt pressure_shadow_update (c : grid.cells)
c.p_temp = c(0,0,-1).p
end
end
local pressure_cpy_update = liszt (c : grid.cells)
local pressure_cpy_update = ebb (c : grid.cells)
c.p = c.p_temp
end
local function pressure_neumann_bnd(cells)
Expand All @@ -294,15 +294,15 @@ local function project_lin_solve(edge, diagonal)
end
end

local liszt compute_divergence (c : grid.cells)
local ebb compute_divergence (c : grid.cells)
-- why the factor of N?
var vx_dx = c(1,0,0).velocity[0] - c(-1,0,0).velocity[0]
var vy_dy = c(0,1,0).velocity[1] - c(0,-1,0).velocity[1]
var vz_dz = c(0,0,1).velocity[2] - c(0,0,-1).velocity[2]
c.divergence = L.float(-(0.5/N)*(vx_dx + vy_dy + vz_dz))
end

local liszt compute_projection (c : grid.cells)
local ebb compute_projection (c : grid.cells)
var grad = L.vec3f(0.5 * N * { c(1,0,0).p - c(-1,0,0).p,
c(0,1,0).p - c(0,-1,0).p,
c(0,0,1).p - c(0,0,-1).p })
Expand Down Expand Up @@ -365,16 +365,16 @@ end)

particles:NewField('next_pos', L.vec3f):Load({0,0,0})
particles:NewField('pos', L.vec3f):Load({0,0,0})
particles:foreach(liszt (p : particles) -- init...
particles:foreach(ebb (p : particles) -- init...
p.pos = p.dual_cell.vertex.cell(-1,-1,-1).center +
L.vec3f({xcwidth/2.0, ycwidth/2.0, zcwidth/2.0})
end)

local liszt locate_particles (p : particles)
local ebb locate_particles (p : particles)
p.dual_cell = grid.dual_locate(p.pos)
end

local liszt compute_particle_velocity (p : particles)
local ebb compute_particle_velocity (p : particles)
var dc = p.dual_cell

-- figure out fractional position in the dual cell in range [0.0, 1.0]
Expand All @@ -395,7 +395,7 @@ local liszt compute_particle_velocity (p : particles)
end end end
end

local liszt update_particle_pos (p : particles)
local ebb update_particle_pos (p : particles)
var r = L.vec3f({
cmath.rand_float() - 0.5,
cmath.rand_float() - 0.5,
Expand All @@ -413,7 +413,7 @@ end
--grid.cells:print()

local source_strength = 100.0
local source_velocity = liszt (c : grid.cells)
local source_velocity = ebb (c : grid.cells)
if cmath.fabs(c.center[0]) < 1.75 and
cmath.fabs(c.center[1]) < 1.75 and
cmath.fabs(c.center[2]) < 1.75
Expand All @@ -427,7 +427,7 @@ local source_velocity = liszt (c : grid.cells)
end
if PERIODIC then
source_strength = 10.0
source_velocity = liszt (c : grid.cells)
source_velocity = ebb (c : grid.cells)
if cmath.fabs(c.center[0]) < 1.75 and
cmath.fabs(c.center[1]) < 1.75 and
cmath.fabs(c.center[2]) < 1.75
Expand All @@ -437,7 +437,7 @@ if PERIODIC then
end
end

local liszt draw_grid (c : grid.cells)
local ebb draw_grid (c : grid.cells)
var color = {1.0, 1.0, 1.0}
vdb.color(color)
var p : L.vec3f = c.center
Expand All @@ -446,7 +446,7 @@ local liszt draw_grid (c : grid.cells)
vdb.line(p, p+v*N*10)
end

local liszt draw_particles (p : particles)
local ebb draw_particles (p : particles)
var color = {1.0,1.0,0.0}
vdb.color(color)
var pos : L.vec3f = p.pos
Expand Down
10 changes: 5 additions & 5 deletions devapps/benchmarks/bunny_diffusion.t
@@ -1,4 +1,4 @@
import "ebb.liszt" -- Every Liszt File should start with this command
import "ebb" -- Every Ebb File should start with this command

-- This line includes the trimesh.t file.
-- As a result, the table 'Trimesh' defined in that file is bound to
Expand Down Expand Up @@ -45,21 +45,21 @@ bunny.vertices.d_temperature:Load(0.0)
-- we define the basic computation functions here:
-- This could also be written as a function over the edges...
local liszt compute_diffusion ( v : bunny.vertices )
local ebb compute_diffusion ( v : bunny.vertices )
for nv in v.neighbors do
v.d_temperature += timestep * conduction *
(nv.temperature - v.temperature)
end
end
local liszt apply_diffusion ( v : bunny.vertices )
local ebb apply_diffusion ( v : bunny.vertices )
var d_temp = v.d_temperature / v.degree
v.temperature += d_temp
avg_temp_change += cmath.fabs(d_temp)
end
local liszt clear_temporary ( v : bunny.vertices )
local ebb clear_temporary ( v : bunny.vertices )
v.d_temperature = 0.0
end
Expand All @@ -68,7 +68,7 @@ end
local vdb = require('ebb.lib.vdb')
local cold = L.Constant(L.vec3f,{0.5,0.5,0.5})
local hot = L.Constant(L.vec3f,{1.0,0.0,0.0})
local liszt debug_tri_draw ( t : bunny.triangles )
local ebb debug_tri_draw ( t : bunny.triangles )
-- color a triangle with the average temperature of its vertices
var avg_temp =
(t.v[0].temperature + t.v[1].temperature + t.v[2].temperature) / 3.0
Expand Down

0 comments on commit 70e44f1

Please sign in to comment.