MATRIX_SIZE=256
TILE_SIZE=16
INPUT_PATH=${CNC_HOME}/examples-input
INPUT_FILE=$(INPUT_PATH)/LUDecomposition/input/${MATRIX_SIZE}.cnc.dat
OUTPUT_PATH=${CNC_HOME}/examples-input
OUTPUT_FILE=${OUTPUT_PATH}/LUDecomposition/output/${MATRIX_SIZE}.out

CNC_GRAPH_FILE=LUDecomposition.cnc
MAIN_CLASS=LUMain
MAIN_FILE=${MAIN_CLASS}.hj
CNC_NUM_WORKERS=16

POLICY=NonBlocking

all: translate build run verify 

translate:
	cnc_t ${CNC_GRAPH_FILE}

# Help First specific build and run (ugly reference to runtime source but better than nothing)
build:
	cnc_c -d classes ${MAIN_FILE}
	g++ RoundOfComparison.cpp -o Compare
        
run:
	cnc_run -policy=${POLICY} -CNC_NUM_WORKERS ${CNC_NUM_WORKERS} -cp classes ${MAIN_CLASS} -noGC -dumpOutput ${MATRIX_SIZE} ${TILE_SIZE} ${INPUT_FILE}

verify:
	./Compare lu_output.txt ${OUTPUT_FILE}

clean:
	rm -Rf A* LUDecompositionGraph.hj *Collection* lu_output.txt Compare
	rm -Rf classes
	rm -Rf *.class
