Skip to content

Commit

Permalink
Merge pull request coduin#18 from buurlage-wits/ludecomposition
Browse files Browse the repository at this point in the history
Added working LU decomposition example
  • Loading branch information
Tombana committed Mar 4, 2015
2 parents f14183d + 1526c55 commit cfcc352
Show file tree
Hide file tree
Showing 6 changed files with 295 additions and 126 deletions.
27 changes: 14 additions & 13 deletions examples/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ESDK=${EPIPHANY_HOME}
ELDF=${ESDK}/bsps/current/fast.ldf

CFLAGS=-std=c99 -O3 -ffast-math -funroll-loops

INCLUDES = \
-I../include\
-I${ESDK}/tools/host/include
Expand Down Expand Up @@ -30,10 +32,10 @@ dirs:
hello: bin/host_hello bin/e_hello.elf bin/e_hello.srec

bin/host_hello: hello/host_hello.c
gcc $(INCLUDES) -o $@ $< $(LIBS) $(HOST_LIBS) $(HOST_LIB_NAMES)
gcc $(CFLAGS) $(INCLUDES) -o $@ $< $(LIBS) $(HOST_LIBS) $(HOST_LIB_NAMES)

bin/e_hello.elf: hello/e_hello.c
e-gcc -T ${ELDF} $(INCLUDES) -o $@ $< $(LIBS) $(E_LIBS) $(E_LIB_NAMES)
e-gcc $(CFLAGS) -T ${ELDF} $(INCLUDES) -o $@ $< $(LIBS) $(E_LIBS) $(E_LIB_NAMES)

bin/e_hello.srec: bin/e_hello.elf
e-objcopy --srec-forceS3 --output-target srec $< $@
Expand All @@ -43,10 +45,10 @@ bin/e_hello.srec: bin/e_hello.elf
e_hello: bin/host_e_hello bin/e_e_hello.elf bin/e_e_hello.srec

bin/host_e_hello: e_hello/host_e_hello.c
gcc $(INCLUDES) -o $@ $< $(LIBS) $(HOST_LIBS) $(HOST_LIB_NAMES)
gcc $(CFLAGS) $(INCLUDES) -o $@ $< $(LIBS) $(HOST_LIBS) $(HOST_LIB_NAMES)

bin/e_e_hello.elf: e_hello/e_e_hello.c
e-gcc -T ${ELDF} $(INCLUDES) -o $@ $< $(LIBS) $(E_LIBS) $(E_LIB_NAMES)
e-gcc $(CFLAGS) -T ${ELDF} $(INCLUDES) -o $@ $< $(LIBS) $(E_LIBS) $(E_LIB_NAMES)

bin/e_e_hello.srec: bin/e_e_hello.elf
e-objcopy --srec-forceS3 --output-target srec $< $@
Expand All @@ -56,10 +58,10 @@ bin/e_e_hello.srec: bin/e_e_hello.elf
dot_product: bin/host_dot_product bin/e_dot_product.elf bin/e_dot_product.srec

bin/host_dot_product: dot_product/host_dot_product.c
gcc $(INCLUDES) -o $@ $< $(LIBS) $(HOST_LIBS) $(HOST_LIB_NAMES)
gcc $(CFLAGS) $(INCLUDES) -o $@ $< $(LIBS) $(HOST_LIBS) $(HOST_LIB_NAMES)

bin/e_dot_product.elf: dot_product/e_dot_product.c
e-gcc -T ${ELDF} $(INCLUDES) -o $@ $< $(LIBS) $(E_LIBS) $(E_LIB_NAMES)
e-gcc $(CFLAGS) -T ${ELDF} $(INCLUDES) -o $@ $< $(LIBS) $(E_LIBS) $(E_LIB_NAMES)

bin/e_dot_product.srec: bin/e_dot_product.elf
e-objcopy --srec-forceS3 --output-target srec $< $@
Expand All @@ -69,10 +71,10 @@ bin/e_dot_product.srec: bin/e_dot_product.elf
lu_decomposition: bin/host_lu_decomposition bin/e_lu_decomposition.elf bin/e_lu_decomposition.srec

bin/host_lu_decomposition: lu_decomposition/host_lu_decomposition.c
gcc $(INCLUDES) -o $@ $< $(LIBS) $(HOST_LIBS) $(HOST_LIB_NAMES)
gcc $(CFLAGS) $(INCLUDES) -o $@ $< $(LIBS) $(HOST_LIBS) $(HOST_LIB_NAMES)

bin/e_lu_decomposition.elf: lu_decomposition/e_lu_decomposition.c
e-gcc -T ${ELDF} $(INCLUDES) -o $@ $< $(LIBS) $(E_LIBS) $(E_LIB_NAMES)
e-gcc $(CFLAGS) -T ${ELDF} $(INCLUDES) -o $@ $< $(LIBS) $(E_LIBS) $(E_LIB_NAMES)

bin/e_lu_decomposition.srec: bin/e_lu_decomposition.elf
e-objcopy --srec-forceS3 --output-target srec $< $@
Expand All @@ -82,10 +84,10 @@ bin/e_lu_decomposition.srec: bin/e_lu_decomposition.elf
memtest: bin/host_memtest bin/e_memtest.elf bin/e_memtest.srec

bin/host_memtest: memtest/host_memtest.c
gcc $(INCLUDES) -o $@ $< $(LIBS) $(HOST_LIBS) $(HOST_LIB_NAMES)
gcc $(CFLAGS) $(INCLUDES) -o $@ $< $(LIBS) $(HOST_LIBS) $(HOST_LIB_NAMES)

bin/e_memtest.elf: memtest/e_memtest.c
e-gcc -T ${ELDF} $(INCLUDES) -o $@ $< $(LIBS) $(E_LIBS) $(E_LIB_NAMES)
e-gcc $(CFLAGS) -T ${ELDF} $(INCLUDES) -o $@ $< $(LIBS) $(E_LIBS) $(E_LIB_NAMES)

bin/e_memtest.srec: bin/e_memtest.elf
e-objcopy --srec-forceS3 --output-target srec $< $@
Expand All @@ -95,16 +97,15 @@ bin/e_memtest.srec: bin/e_memtest.elf
bspbench: bin/host_bspbench bin/e_bspbench.elf bin/e_bspbench.srec

bin/host_bspbench: bspbench/host_bspbench.c
gcc $(INCLUDES) -o $@ $< $(LIBS) $(HOST_LIBS) $(HOST_LIB_NAMES)
gcc $(CFLAGS) $(INCLUDES) -o $@ $< $(LIBS) $(HOST_LIBS) $(HOST_LIB_NAMES)

bin/e_bspbench.elf: bspbench/e_bspbench.c
e-gcc -O3 -ffast-math -funroll-loops -T ${ELDF} $(INCLUDES) -o $@ $< $(LIBS) $(E_LIBS) $(E_LIB_NAMES)
e-gcc $(CFLAGS) -T ${ELDF} $(INCLUDES) -o $@ $< $(LIBS) $(E_LIBS) $(E_LIB_NAMES)

bin/e_bspbench.srec: bin/e_bspbench.elf
e-objcopy --srec-forceS3 --output-target srec $< $@

########################################################


clean:
rm bin/*
14 changes: 6 additions & 8 deletions examples/lu_decomposition/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@ see the files COPYING and COPYING.LESSER. If not, see
<http://www.gnu.org/licenses/>.
*/

#define LOC_M 0x4000
#define LOC_N 0x4001
#define LOC_DIM 0x4002
#define LOC_MATRIX 0x4004
#define LOC_M 0x4800
#define LOC_N 0x4804
#define LOC_DIM 0x4808
#define LOC_MATRIX 0x480c

#define LOC_RS 0x5800
#define LOC_ARK (LOC_RS + sizeof(int) * M)
#define LOC_R (LOC_ARK + sizeof(float))
#define LOC_R (LOC_ARK + sizeof(float) * M)
#define LOC_PI (LOC_R + sizeof(int))
#define LOC_PI_IN (LOC_PI + sizeof(int) * N)
#define LOC_PI_IN (LOC_PI + sizeof(int) * entries_per_col)
#define LOC_ROW_IN (LOC_PI_IN + sizeof(int) * 2)
#define LOC_COL_IN (LOC_ROW_IN + sizeof(float) * dim)

#define LOC_RESULT 0x6000
Loading

0 comments on commit cfcc352

Please sign in to comment.