diff --git a/P2/Makefile b/P2/Makefile index a69e083f85e5b1661f77d4428a3c5a321f5ca9a6..20bb0c2a2bcb6325dfc027f50187f978531b6e2b 100644 --- a/P2/Makefile +++ b/P2/Makefile @@ -1,14 +1,18 @@ CXX = mpic++ -CXXFLAGS = -std=c++17 -Wall -Wextra -O0 +CXXFLAGS = -std=c++17 -Wall -Wextra -O0 -g TARGET = distributedtests OBJ = matrix.o distributedmatrix.o distributedtests.o mlp_sgd_distributed.o globals.o HEADERS = abstractmatrix.hpp matrix.hpp distributedmatrix.hpp globals.hpp +NVTX_INC = -I/usr/local/cuda/include +NVTX_LIB = -L/usr/local/cuda/lib64 -lnvToolsExt +# Cible par défaut all: $(MAKE) clean && $(MAKE) run +# Cible pour la compilation $(TARGET): $(OBJ) - $(CXX) $(CXXFLAGS) -o $(TARGET) $(OBJ) + $(CXX) $(CXXFLAGS) $(NVTX_LIB) -o $(TARGET) $(OBJ) matrix.o: matrix.cpp matrix.hpp abstractmatrix.hpp $(CXX) $(CXXFLAGS) -c matrix.cpp @@ -25,10 +29,16 @@ mlp_sgd_distributed.o: mlp_sgd_distributed.cpp globals.hpp abstractmatrix.hpp ma globals.o: globals.cpp globals.hpp mlp_sgd_distributed.cpp $(CXX) $(CXXFLAGS) -c globals.cpp +# Cible pour l'exécution classique run: $(TARGET) mpirun -np 4 ./$(TARGET) +# Cible pour profiler avec nsys +profile: $(TARGET) + nsys profile --trace=mpi,cuda,nvtx,osrt --output=profile_mpi_computation mpirun -np 4 ./$(TARGET) + +# Nettoyer les fichiers objets et le binaire clean: rm -f $(OBJ) $(TARGET) -.PHONY: all run clean +.PHONY: all run clean profile