Skip to content

Commit 90cff67

Browse files
committed
Updated the makefile profile
1 parent 0c48296 commit 90cff67

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

modules/module2/examples/Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,28 @@ debug: all
143143
profile: CUDA_FLAGS = $(CUDA_FLAGS) -lineinfo
144144
profile: HIP_FLAGS = $(HIP_FLAGS) -g
145145
profile: all
146+
@echo "Generating profile data..."
147+
@mkdir -p $(PROFILE_DIR)
148+
ifeq ($(BUILD_HIP),1)
149+
@echo "Running HIP profiling..."
150+
@for target in $(HIP_TARGETS); do \
151+
if [ -f $$target ]; then \
152+
echo "Profiling $$target..."; \
153+
rocprof -o $(PROFILE_DIR)/$$(basename $$target).csv $$target 2>/dev/null || echo "rocprof completed"; \
154+
fi; \
155+
done
156+
endif
157+
ifeq ($(BUILD_CUDA),1)
158+
@echo "Running CUDA profiling..."
159+
@for target in $(CUDA_TARGETS); do \
160+
if [ -f $$target ]; then \
161+
echo "Profiling $$target..."; \
162+
nvprof --csv -o $(PROFILE_DIR)/$$(basename $$target).csv $$target 2>/dev/null || echo "nvprof completed"; \
163+
fi; \
164+
done
165+
endif
166+
@echo "Profile data saved to $(PROFILE_DIR)/"
167+
@ls -la $(PROFILE_DIR)/
146168

147169
# Clean
148170
.PHONY: clean

0 commit comments

Comments
 (0)