Skip to content
Snippets Groups Projects
Commit a0a17570 authored by Jan Hönig's avatar Jan Hönig
Browse files

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

parent 92c29b18
No related branches found
No related tags found
1 merge request!1Add CUDA support
Pipeline #37819 skipped
......@@ -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:
......
......@@ -14,6 +14,8 @@ INCLUDES += -I./include
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)
......@@ -28,6 +30,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