Skip to content
Snippets Groups Projects
Commit 96c63098 authored by Jan Hönig's avatar Jan Hönig Committed by Christoph Alt
Browse files

Working CUDA benchmark Version. CUDA needs '.cu' files, otherwise it doesn't work?

parent c51eee43
No related branches found
No related tags found
1 merge request!1Add CUDA support
......@@ -41,10 +41,11 @@ def generate_benchmark_gpu(kernel_asts: Union[KernelFunction, List[KernelFunctio
f.write(header)
source = kernel_source(kernel_ast)
with open(src_path / f'{kernel_name}.c', 'w+') as f:
# TODO CUDA specific suffix
with open(src_path / f'{kernel_name}.cu', 'w+') as f:
f.write(source)
with open(src_path / 'main.c', 'w+') as f:
with open(src_path / 'main.cu', 'w+') as f:
f.write(kernel_main(kernel_asts))
copy_static_files(path)
......@@ -77,6 +78,8 @@ def copy_static_files(path: Path) -> None:
target_path = include_path / file_name
elif file_name[-1] == 'c':
target_path = src_path / file_name
# TODO CUDA specific suffix:
target_path = target_path.with_suffix('.cu')
else:
target_path = path / file_name
with open(target_path, 'w+') as f:
......
......@@ -29,6 +29,8 @@ LIBS += -llikwid
VPATH = $(SRC_DIR)
ASM = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.s,$(wildcard $(SRC_DIR)/*.c))
OBJ = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o,$(wildcard $(SRC_DIR)/*.c))
# TODO CUDA specific SUFFIX
OBJ += $(patsubst $(SRC_DIR)/%.cu, $(BUILD_DIR)/%.o,$(wildcard $(SRC_DIR)/*.cu))
CFLAGS := $(CFLAGS) $(DEFINES) $(INCLUDES)
......@@ -43,6 +45,12 @@ $(BUILD_DIR)/%.o: %.c
$(Q)$(CC) -c $(CFLAGS) $< -o $@
$(Q)$(CC) $(CFLAGS) -MT $(@:.d=.o) -MM $< > $(BUILD_DIR)/$*.d
# TODO CUDA specific SUFFIX
$(BUILD_DIR)/%.o: %.cu
@echo "===> COMPILE $@"
$(Q)$(CC) -c $(CFLAGS) $< -o $@
$(Q)$(CC) $(CFLAGS) -MT $(@:.d=.o) -MM $< > $(BUILD_DIR)/$*.d
$(BUILD_DIR)/%.s: %.c
@echo "===> GENERATE ASM $@"
$(Q)$(CC) -S $(CFLAGS) $< -o $@
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment