From: Sebastian Date: Thu, 26 Jun 2014 01:43:21 +0000 (+0000) Subject: add compile-time error for oversized grids X-Git-Url: http://sraa.de/git/?a=commitdiff_plain;h=ce7aa2f399c9fab364533cfe67e189b90f51ca3a;p=lattice-boltzmann-epiphany.git add compile-time error for oversized grids --- diff --git a/lb/Makefile b/lb/Makefile index 949e1a6..4bb87ae 100644 --- a/lb/Makefile +++ b/lb/Makefile @@ -34,6 +34,7 @@ EELFS = $(EAPPS:$(DEST)%srec=$(EDEST)%elf) .SECONDARY: .PHONY: all help host target folders run clean +.NOTPARALLEL: clean # === Phony Rules ========================================================= help: @@ -69,15 +70,15 @@ clean: 2>/dev/null $(HDEST): - @$(ECHO) "\tMKDIR $(HDEST)" + @$(ECHO) "\t(HOST) MKDIR $(HDEST)" @mkdir -p $(HDEST) $(EDEST): - @$(ECHO) "\tMKDIR $(EDEST)" + @$(ECHO) "\t(HOST) MKDIR $(EDEST)" @mkdir -p $(EDEST) $(DEST): - @$(ECHO) "\tMKDIR $(DEST)" + @$(ECHO) "\t(HOST) MKDIR $(DEST)" @mkdir -p $(DEST) # === Host Rules ========================================================== diff --git a/lb/esrc/lb_2d.c b/lb/esrc/lb_2d.c index 99f6550..6f36cef 100644 --- a/lb/esrc/lb_2d.c +++ b/lb/esrc/lb_2d.c @@ -22,6 +22,8 @@ void delay(void) int main() { + BUILD_BUG(BLOCK_X * BLOCK_Y * sizeof(d2q9_node_t) > 24*1024); + const FLOAT omega = 1.0; init_block(block); diff --git a/lb/shared.h b/lb/shared.h index 44515d9..7000418 100644 --- a/lb/shared.h +++ b/lb/shared.h @@ -3,10 +3,15 @@ #define _SHARED_H_ #include + +/* PACKED is defined for e-gcc, but not for gcc */ #ifndef PACKED #define PACKED __attribute__((packed)) #endif /* PACKED */ +/* produce compile-time errors if condition is true */ +#define BUILD_BUG(c) do { ((void)sizeof(char[1 - 2*!!(c)])); } while(0); + /* number of cores */ #define NUM_CORES 16