From 196703487e33ec383dab2a0cededb2289e342083 Mon Sep 17 00:00:00 2001 From: tgrogers Date: Tue, 16 May 2017 13:37:29 -0400 Subject: Changing the version detection to be much more detailed. Now the git commit # and branch will be embedded in the built executable and print out when gpgpu-sim runs --- version_detection.mk | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'version_detection.mk') diff --git a/version_detection.mk b/version_detection.mk index 8796d5c..00a8b1f 100644 --- a/version_detection.mk +++ b/version_detection.mk @@ -30,7 +30,13 @@ ifeq ($(GPGPUSIM_ROOT),) else GPGPUSIM_VERSION=$(shell cat $(GPGPUSIM_ROOT)/version | awk '/Version/ {print $$8}' ) -GPGPUSIM_BUILD=$(shell cat $(GPGPUSIM_ROOT)/version | awk '/Change/ {print $$6}' ) + +#Detect Git branch and commit # +GIT_BRANCH := $(shell git branch | grep "\*" | sed -re 's/\*\s+(.*)/\1/') +GIT_COMMIT := $(shell git log -n 1 | head -1 | sed -re 's/commit (.*)/\1/') +GIT_FILES_CHANGED := $(shell git diff --numstat --cached && git diff --numstat | wc | sed -re 's/^\s+([0-9]+).*/\1/') +GPGPUSIM_BUILD := "gpgpu-sim_$(GIT_BRANCH)_$(GIT_COMMIT)_modified_$(GIT_FILES_CHANGED)" +$(shell mkdir -p $(SIM_OBJ_FILES_DIR)/libcuda && echo "const char *g_gpgpusim_build_string=\"$(GPGPUSIM_BUILD)\";" > $(SIM_OBJ_FILES_DIR)/detailed_version) endif # Detect CUDA Runtime Version @@ -42,4 +48,3 @@ CC_VERSION := $(shell gcc --version | head -1 | awk '{for(i=1;i<=NF;i++){ if(mat # Detect Support for C++11 (C++0x) from GCC Version GNUC_CPP0X := $(shell gcc --version | perl -ne 'if (/gcc\s+\(.*\)\s+([0-9.]+)/){ if($$1 >= 4.3) {$$n=1} else {$$n=0;} } END { print $$n; }') - -- cgit v1.3 From 8b44f564221b9a0503ca04ccdb463bd60ae8c33c Mon Sep 17 00:00:00 2001 From: tgrogers Date: Tue, 16 May 2017 16:56:54 -0400 Subject: Fixing a bug with where the build version is made. Moveing it after the right directories ect are defined --- Makefile | 3 +++ version_detection.mk | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'version_detection.mk') diff --git a/Makefile b/Makefile index 78ef892..7a7b187 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,9 @@ ifneq ($(shell which nvcc), "") endif endif + +$(shell mkdir -p $(SIM_OBJ_FILES_DIR)/libcuda && echo "const char *g_gpgpusim_build_string=\"$(GPGPUSIM_BUILD)\";" > $(SIM_OBJ_FILES_DIR)/detailed_version) + LIBS = cuda-sim gpgpu-sim_uarch $(INTERSIM) gpgpusimlib diff --git a/version_detection.mk b/version_detection.mk index 00a8b1f..f9c333f 100644 --- a/version_detection.mk +++ b/version_detection.mk @@ -36,7 +36,6 @@ GIT_BRANCH := $(shell git branch | grep "\*" | sed -re 's/\*\s+(.*)/\1/') GIT_COMMIT := $(shell git log -n 1 | head -1 | sed -re 's/commit (.*)/\1/') GIT_FILES_CHANGED := $(shell git diff --numstat --cached && git diff --numstat | wc | sed -re 's/^\s+([0-9]+).*/\1/') GPGPUSIM_BUILD := "gpgpu-sim_$(GIT_BRANCH)_$(GIT_COMMIT)_modified_$(GIT_FILES_CHANGED)" -$(shell mkdir -p $(SIM_OBJ_FILES_DIR)/libcuda && echo "const char *g_gpgpusim_build_string=\"$(GPGPUSIM_BUILD)\";" > $(SIM_OBJ_FILES_DIR)/detailed_version) endif # Detect CUDA Runtime Version -- cgit v1.3 From 1e7f2f0d857666ee7edd7bd0d6b0e52a6588522e Mon Sep 17 00:00:00 2001 From: tgrogers Date: Tue, 16 May 2017 23:03:47 -0400 Subject: Getting rid of the branch since it gets weird, espeically in travis --- version_detection.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'version_detection.mk') diff --git a/version_detection.mk b/version_detection.mk index f9c333f..00a86c0 100644 --- a/version_detection.mk +++ b/version_detection.mk @@ -32,10 +32,9 @@ else GPGPUSIM_VERSION=$(shell cat $(GPGPUSIM_ROOT)/version | awk '/Version/ {print $$8}' ) #Detect Git branch and commit # -GIT_BRANCH := $(shell git branch | grep "\*" | sed -re 's/\*\s+(.*)/\1/') GIT_COMMIT := $(shell git log -n 1 | head -1 | sed -re 's/commit (.*)/\1/') GIT_FILES_CHANGED := $(shell git diff --numstat --cached && git diff --numstat | wc | sed -re 's/^\s+([0-9]+).*/\1/') -GPGPUSIM_BUILD := "gpgpu-sim_$(GIT_BRANCH)_$(GIT_COMMIT)_modified_$(GIT_FILES_CHANGED)" +GPGPUSIM_BUILD := "gpgpu-sim_git-commit-$(GIT_COMMIT)_modified_$(GIT_FILES_CHANGED)" endif # Detect CUDA Runtime Version -- cgit v1.3