Skip to content

Commit

Permalink
Merge pull request #257 from intel/develop
Browse files Browse the repository at this point in the history
4.00 code from develop branch
  • Loading branch information
chuckyount authored Nov 8, 2022
2 parents 3dbd67d + 85fc5d9 commit 48800a5
Show file tree
Hide file tree
Showing 193 changed files with 21,561 additions and 13,949 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
*.o
bin
lib
build
logs
r[0-9][0-9][0-9]*
vtune*

154 changes: 80 additions & 74 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
##############################################################################
## YASK: Yet Another Stencil Kit
## Copyright (c) 2014-2021, Intel Corporation
## Copyright (c) 2014-2022, Intel Corporation
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to
Expand Down Expand Up @@ -30,7 +30,7 @@
# The 'stencil' and 'arch' vars are most important and should always be specified.
#
# stencil: sets stencil problem to be solved.
# For a list of current stencils, see src/kernel/Makefile or run the following:
# For a list of current stencils, run the following:
# % make compiler
# % bin/yask_compiler.exe -h
# You can also create your own stencil; see the documentation.
Expand All @@ -44,26 +44,14 @@
#
# real_bytes: FP precision: 4=float, 8=double.
#
# fold: How to fold vectors (x*y*z).
# fold_4byte: How to fold vectors when real_bytes=4.
# fold_8byte: How to fold vectors when real_bytes=8.
#
# cluster: How many folded vectors to evaluate simultaneously.
# fold: In which dimension(s) to vectorize.
# cluster: How many vectors to evaluate simultaneously.
#
# pfd_l1: L1 prefetch distance (0 => disabled).
# pfd_l2: L2 prefetch distance (0 => disabled).
#
# omp_region_schedule: OMP schedule policy for region loop.
# omp_block_schedule: OMP schedule policy for nested OpenMP block loop.
# omp_misc_schedule: OMP schedule policy for OpenMP misc loop.
#
# def_block_threads: Number of threads to use in nested OpenMP block loop by default.
# def_thread_divisor: Divide number of OpenMP threads by this factor by default.
# def_*_args: Default cmd-line args for specific settings.
# more_def_args: Additional default cmd-line args.
#
# allow_new_grid_types: Whether to allow grid types not defined in the stencil
# to be created via new_grid() and new_fixed_size_grid().

# Common defaults.
offload ?= 0

# Common settings.
YASK_BASE := $(abspath .)
Expand All @@ -80,17 +68,14 @@ include $(YASK_BASE)/src/common/common.mk
YK_MAKE := $(MAKE) $(YASK_MFLAGS) -C src/kernel YASK_OUTPUT_DIR=$(YASK_OUT_BASE)
YC_MAKE := $(MAKE) $(YASK_MFLAGS) -C src/compiler YASK_OUTPUT_DIR=$(YASK_OUT_BASE)

# Misc dirs & files.
TUPLE_TEST_EXEC := $(BIN_OUT_DIR)/yask_tuple_test.exe
COMBO_TEST_EXEC := $(BIN_OUT_DIR)/yask_combo_test.exe

# Compiler and default flags--used only for targets in this Makefile.
# For compiler, use YC_CXX*.
# For kernel, use YK_CXX*.
CXX := g++
CXXFLAGS := -g -std=c++11 -Wall -O2
CXXFLAGS += $(addprefix -I,$(INC_DIR) $(COMM_DIR))
CXXFLAGS += -fopenmp
# Default flags--used only for targets in this Makefile.
# For compiler, use YC_CXX* vars.
# For kernel, use YK_CXX* vars.
YASK_CXX := $(CXX)
YASK_CXXOPT := -O2
YASK_CXXFLAGS := -g -std=c++17 -Wall $(YASK_CXXOPT)
YASK_CXXFLAGS += $(addprefix -I,$(INC_DIR) $(COMM_DIR))
YASK_CXXFLAGS += -fopenmp

######## Primary targets & rules
# NB: must set stencil and arch to generate the desired kernel.
Expand Down Expand Up @@ -136,6 +121,51 @@ docs/api/html/index.html: include/*.hpp include/*/*.hpp docs/api/*.*
find docs/api/html -type f | xargs -r rm
cd docs/api; doxygen doxygen_config.txt

######## Misc targets

code-stats:
$(YK_MAKE) $@

docs: api-docs

tags:
rm -f TAGS ; find src include -name '*.[ch]pp' | xargs etags -C -a

# Remove intermediate files.
# Should not trigger remake of stencil compiler, so does not invoke clean in compiler dir.
# Make this target before rebuilding YASK with any new parameters.
clean:
$(YK_MAKE) $@

# Remove executables, generated documentation, etc. (not logs).
# Use 'find *' instead of 'find .' to avoid searching in '.git'.
realclean: clean
rm -rf $(LIB_OUT_DIR) $(BIN_OUT_DIR) $(BUILD_OUT_DIR)
rm -fv TAGS '*~'
- find src include utils -name '*~' -print -delete
- find src -name '*.optrpt' -print -delete
- find src -name __pycache__ -print -delete
$(YC_MAKE) $@
$(YK_MAKE) $@
- find $(PY_OUT_DIR) -mindepth 1 '!' -name __init__.py -print -delete
- rmdir -v --ignore-fail-on-non-empty $(PY_OUT_DIR)
- rmdir -v --ignore-fail-on-non-empty $(YASK_OUT_BASE)

help:
@ $(YC_MAKE) $@
@ $(YK_MAKE) $@
@ echo " "
@ echo "'setenv CXX_PREFIX ccache' or 'export CXX_PREFIX=ccache' to use ccache."

#################################
########### Tests ###############
#################################
# TODO: convert all testing to a separate test framework.

# Test dirs & files.
TUPLE_TEST_EXEC := $(BIN_OUT_DIR)/yask_tuple_test.exe
COMBO_TEST_EXEC := $(BIN_OUT_DIR)/yask_combo_test.exe

#### API tests.

# The tests listed here are designed to test various combinations of the
Expand Down Expand Up @@ -188,34 +218,39 @@ py-yc-api-and-cxx-yk-api-test:
# When the built-in stencil examples aren't being used,
# "stencil=api_test" in the commands below is simply used to
# create file names.
combo-api-tests:
yc-combo-api-tests:
$(MAKE) clean; $(MAKE) stencil=iso3dfd yc-and-cxx-yk-api-test
$(MAKE) clean; $(MAKE) stencil=iso3dfd yc-and-py-yk-api-test

cxx-yc-combo-api-tests:
$(MAKE) clean; $(MAKE) stencil=api_test cxx-yc-api-and-yk-test
$(MAKE) clean; $(MAKE) stencil=api_test py-yc-api-and-yk-test
$(MAKE) clean; $(MAKE) stencil=api_test cxx-yc-api-and-cxx-yk-api-test
$(MAKE) clean; $(MAKE) stencil=api_test py-yc-api-and-py-yk-api-test
$(MAKE) clean; $(MAKE) stencil=api_test cxx-yc-api-and-py-yk-api-test

py-yc-combo-api-tests:
$(MAKE) clean; $(MAKE) stencil=api_test py-yc-api-and-yk-test
$(MAKE) clean; $(MAKE) stencil=api_test py-yc-api-and-py-yk-api-test
$(MAKE) clean; $(MAKE) stencil=api_test py-yc-api-and-cxx-yk-api-test

######## Misc targets
combo-api-tests:
$(MAKE) yc-combo-api-tests
if (( $(offload) == 0 )); then \
$(MAKE) cxx-yc-combo-api-tests && \
$(MAKE) py-yc-combo-api-tests; fi

# NB: set arch var if applicable.
# NB: save some test time by using YK_CXXOPT=-O2.

yc-and-yk-test:
$(YK_MAKE) $@

code-stats:
$(YK_MAKE) $@

$(TUPLE_TEST_EXEC): $(COMM_DIR)/tests/tuple_test.cpp $(COMM_DIR)/*.*pp
$(MKDIR) $(dir $@)
$(CXX_PREFIX) $(CXX) $(CXXFLAGS) $(LFLAGS) -o $@ $< $(COMM_DIR)/tuple.cpp $(COMM_DIR)/common_utils.cpp
$(CXX_PREFIX) $(YASK_CXX) $(YASK_CXXFLAGS) $(LFLAGS) -o $@ $< $(COMM_DIR)/tuple.cpp $(COMM_DIR)/common_utils.cpp

$(COMBO_TEST_EXEC): $(COMM_DIR)/tests/combo_test.cpp $(COMM_DIR)/*.*pp
$(MKDIR) $(dir $@)
$(CXX_PREFIX) $(CXX) $(CXXFLAGS) $(LFLAGS) -o $@ $< $(COMM_DIR)/combo.cpp
$(CXX_PREFIX) $(YASK_CXX) $(YASK_CXXFLAGS) $(LFLAGS) -o $@ $< $(COMM_DIR)/combo.cpp

tuple-test: $(TUPLE_TEST_EXEC)
@echo '*** Running the C++ YASK tuple test...'
Expand All @@ -229,48 +264,19 @@ api-tests: compiler-api
$(MAKE) combo-api-tests
$(YK_MAKE) $@

all-tests: compiler-api
unit-tests:
$(MAKE) tuple-test
$(MAKE) combo-test

all-tests: compiler-api unit-tests
$(YK_MAKE) $@
$(MAKE) combo-api-tests
$(MAKE) clean
@echo "All YASK tests have been run"

all:
$(MAKE) realclean
$(MAKE) tags
$(MAKE) default
$(MAKE) all-tests
$(MAKE) clean
$(MAKE) default
$(MAKE) api-all

docs: api-docs

tags:
rm -f TAGS ; find src include -name '*.[ch]pp' | xargs etags -C -a

# Remove intermediate files.
# Should not trigger remake of stencil compiler, so does not invoke clean in compiler dir.
# Make this target before rebuilding YASK with any new parameters.
clean:
$(YK_MAKE) $@

# Remove executables, generated documentation, etc. (not logs).
# Use 'find *' instead of 'find .' to avoid searching in '.git'.
realclean: clean
rm -rf $(LIB_OUT_DIR) $(BIN_OUT_DIR) $(BUILD_OUT_DIR)
rm -fv TAGS '*~'
- find * -name '*~' -print -delete
- find * -name '*.optrpt' -print -delete
- find * -name __pycache__ -print -delete
$(YC_MAKE) $@
$(YK_MAKE) $@
- find $(PY_OUT_DIR) -mindepth 1 '!' -name __init__.py -print -delete
- rmdir -v --ignore-fail-on-non-empty $(PY_OUT_DIR)
- rmdir -v --ignore-fail-on-non-empty $(YASK_OUT_BASE)

help:
@ $(YC_MAKE) $@
@ $(YK_MAKE) $@
@ echo " "
@ echo "'setenv CXX_PREFIX ccache' or 'export CXX_PREFIX=ccache' to use ccache."
$(MAKE) all-tests
Loading

0 comments on commit 48800a5

Please sign in to comment.