diff --git a/main.c b/main.c index 5495f9b..97ef736 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -#include "cythoned/bridge.h" +#include "build/bridge.h" #include #include @@ -17,15 +17,16 @@ #define TAG_INSTR 9 #define TAG_TERMT 10 -#define COMM 5 -#define ITER 500 +#define COMM 25 +#define ITER 100 #define BS 32 #define EMB 32 #define WIN 2 #define FLPC 1 #define in_range(i, x) (size_t i = 0; i < (x); i++) -// I am honestly VERY sorry for this but power corrupts even the best of us +// I am honestly VERY sorry for this +// but the power of macros corrupts even the best of us #define INFO_PRINTF(fmt, ...) \ do { fprintf(stderr, fmt, __VA_ARGS__); } while(0) @@ -36,7 +37,7 @@ int g_argc; // sorry! -typedef enum{ +typedef enum { TOKENIZER, FILTERER, BATCHER, diff --git a/meson.build b/meson.build index 50f8270..7e2ad46 100644 --- a/meson.build +++ b/meson.build @@ -11,9 +11,18 @@ numpy_header = include_directories(run_command( 'python3', '-c', 'import numpy;print(numpy.get_include())' ).stdout().strip()) -executable( - 'fedavg_mpi', 'main.c', 'cythoned/bridge.c', +cython = find_program('cython') +bridge = custom_target('bridge', + output: ['bridge.c', 'bridge.h'], + input: 'bridge.pyx', + command: [cython, '-3', '@INPUT@', '-o', 'bridge.c']) + +executable('fedavg_mpi', + 'main.c', bridge, dependencies: [mpi, python], include_directories: numpy_header, - link_args: '-Wl,-w' -) + link_args: '-Wl,-w') + +run_command('cp', + meson.current_build_dir() + 'compile_commands.json', + meson.current_source_dir())