Add HYPRE_DEVELOP variables (#472)
This commit introduces three new variables to the 'HYPRE_config' file through both the autoconf and CMake builds. They are defined only when there is a '.git' directory present, and are otherwise left undefined. These new variables may help users who work directly with the development branch of hypre to keep their code current and backward compatible with previous releases and also individual commits between those releases. The new variables are: HYPRE_DEVELOP_STRING - a string created from the 'git describe' command that indicates the last release tag, the number of commits beyond that last release, and the corresponding commit hash. HYPRE_DEVELOP_NUMBER - the number of commits since the last release. HYPRE_DEVELOP_BRANCH - defined only if the main development branch is being used, and is set to the name of that branch (currently master). The commit also adds runtime regression tests for the variables in the 'src/test' directory.
This commit is contained in:
		
							parent
							
								
									c9b1679970
								
							
						
					
					
						commit
						408f361bd0
					
				| @ -1,2 +1 @@ | ||||
| TEST_struct/[^b]*.sh | ||||
| 
 | ||||
| TEST_struct/*.sh | ||||
|  | ||||
| @ -28,6 +28,30 @@ if (${HYPRE_SOURCE_DIR} STREQUAL ${HYPRE_BINARY_DIR}) | ||||
|   message(FATAL_ERROR "In-place build not allowed! Please use a separate build directory. See the Users Manual or INSTALL file for details.") | ||||
| endif () | ||||
| 
 | ||||
| if (EXISTS ${HYPRE_SOURCE_DIR}/../.git) | ||||
|   execute_process(COMMAND git -C ${HYPRE_SOURCE_DIR} describe --match v* --long --abbrev=9 | ||||
|                   OUTPUT_VARIABLE develop_string | ||||
|                   OUTPUT_STRIP_TRAILING_WHITESPACE) | ||||
|   execute_process(COMMAND git -C ${HYPRE_SOURCE_DIR} describe --match v* --abbrev=0 | ||||
|                   OUTPUT_VARIABLE develop_lastag | ||||
|                   OUTPUT_STRIP_TRAILING_WHITESPACE) | ||||
|   execute_process(COMMAND git -C ${HYPRE_SOURCE_DIR} rev-list --count ${develop_lastag}..HEAD | ||||
|                   OUTPUT_VARIABLE develop_number | ||||
|                   OUTPUT_STRIP_TRAILING_WHITESPACE) | ||||
|   execute_process(COMMAND git -C ${HYPRE_SOURCE_DIR} rev-parse --abbrev-ref HEAD | ||||
|                   OUTPUT_VARIABLE develop_branch | ||||
|                   OUTPUT_STRIP_TRAILING_WHITESPACE) | ||||
|   set(HYPRE_DEVELOP_STRING  ${develop_string}) | ||||
|   set(HYPRE_DEVELOP_NUMBER  ${develop_number}) | ||||
|   if (develop_branch MATCHES "master") | ||||
|     set(HYPRE_DEVELOP_BRANCH  ${develop_branch}) | ||||
|   else () | ||||
|     message(STATUS "NOTE: On branch ${develop_branch}, not the main development branch") | ||||
|   endif () | ||||
| else () | ||||
|   message(STATUS "NOTE: Could not find .git directory") | ||||
| endif () | ||||
| 
 | ||||
| # Set cmake module path | ||||
| set(CMAKE_MODULE_PATH "${HYPRE_SOURCE_DIR}/config/cmake" "${CMAKE_MODULE_PATH}") | ||||
| include(HYPRE_CMakeUtilities) | ||||
|  | ||||
| @ -12,6 +12,10 @@ | ||||
| #define HYPRE_RELEASE_TIME    "@HYPRE_TIME@" | ||||
| #define HYPRE_RELEASE_BUGS    "@HYPRE_BUGS@" | ||||
| 
 | ||||
| #cmakedefine HYPRE_DEVELOP_STRING  "@HYPRE_DEVELOP_STRING@" | ||||
| #cmakedefine HYPRE_DEVELOP_NUMBER   @HYPRE_DEVELOP_NUMBER@ | ||||
| #cmakedefine HYPRE_DEVELOP_BRANCH  "@HYPRE_DEVELOP_BRANCH@" | ||||
| 
 | ||||
| /* Use long long int for HYPRE_BigInt */ | ||||
| #cmakedefine HYPRE_MIXEDINT 1 | ||||
| 
 | ||||
|  | ||||
| @ -62,6 +62,15 @@ | ||||
| /* Define to 1 if in debug mode */ | ||||
| #undef HYPRE_DEBUG | ||||
| 
 | ||||
| /* Main development branch? */ | ||||
| #undef HYPRE_DEVELOP_BRANCH | ||||
| 
 | ||||
| /* Develop branch commit number */ | ||||
| #undef HYPRE_DEVELOP_NUMBER | ||||
| 
 | ||||
| /* Develop branch string */ | ||||
| #undef HYPRE_DEVELOP_STRING | ||||
| 
 | ||||
| /* Define to 1 if using OpenMP on device [target alloc version] */ | ||||
| #undef HYPRE_DEVICE_OPENMP_ALLOC | ||||
| 
 | ||||
|  | ||||
| @ -105,6 +105,20 @@ AC_SUBST(HYPRE_BUGS) | ||||
| 
 | ||||
| AC_SUBST(HYPRE_SRCDIR) | ||||
| 
 | ||||
| AC_CHECK_FILE([$HYPRE_SRCDIR/../.git], | ||||
|   [develop_string=$(git -C $HYPRE_SRCDIR describe --match 'v*' --long --abbrev=9) | ||||
|    develop_lastag=$(git -C $HYPRE_SRCDIR describe --match 'v*' --abbrev=0) | ||||
|    develop_number=$(git -C $HYPRE_SRCDIR rev-list --count $develop_lastag..HEAD) | ||||
|    develop_branch=$(git -C $HYPRE_SRCDIR rev-parse --abbrev-ref HEAD) | ||||
|    AC_DEFINE_UNQUOTED(HYPRE_DEVELOP_STRING, ["$develop_string"], [Develop branch string]) | ||||
|    AC_DEFINE_UNQUOTED(HYPRE_DEVELOP_NUMBER, [$develop_number],   [Develop branch commit number]) | ||||
|    AS_IF([test "x$develop_branch" = "xmaster"], | ||||
|      [AC_DEFINE_UNQUOTED(HYPRE_DEVELOP_BRANCH, ["$develop_branch"], [Main development branch?])], | ||||
|      [AC_MSG_NOTICE([NOTE: On branch $develop_branch, not the main development branch])] | ||||
|    )], | ||||
|   [AC_MSG_NOTICE([NOTE: Could not find .git directory])] | ||||
| ) | ||||
| 
 | ||||
| dnl ********************************************************************* | ||||
| dnl * Clear variables defined by AC_INIT to avoid name conflicts with | ||||
| dnl * other packages. | ||||
|  | ||||
							
								
								
									
										50
									
								
								src/configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										50
									
								
								src/configure
									
									
									
									
										vendored
									
									
								
							| @ -2683,6 +2683,56 @@ _ACEOF | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| as_ac_File=`$as_echo "ac_cv_file_$HYPRE_SRCDIR/../.git" | $as_tr_sh` | ||||
| { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $HYPRE_SRCDIR/../.git" >&5 | ||||
| $as_echo_n "checking for $HYPRE_SRCDIR/../.git... " >&6; } | ||||
| if eval \${$as_ac_File+:} false; then : | ||||
|   $as_echo_n "(cached) " >&6 | ||||
| else | ||||
|   test "$cross_compiling" = yes && | ||||
|   as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 | ||||
| if test -r "$HYPRE_SRCDIR/../.git"; then | ||||
|   eval "$as_ac_File=yes" | ||||
| else | ||||
|   eval "$as_ac_File=no" | ||||
| fi | ||||
| fi | ||||
| eval ac_res=\$$as_ac_File | ||||
| 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 | ||||
| $as_echo "$ac_res" >&6; } | ||||
| if eval test \"x\$"$as_ac_File"\" = x"yes"; then : | ||||
|   develop_string=$(git -C $HYPRE_SRCDIR describe --match 'v*' --long --abbrev=9) | ||||
|    develop_lastag=$(git -C $HYPRE_SRCDIR describe --match 'v*' --abbrev=0) | ||||
|    develop_number=$(git -C $HYPRE_SRCDIR rev-list --count $develop_lastag..HEAD) | ||||
|    develop_branch=$(git -C $HYPRE_SRCDIR rev-parse --abbrev-ref HEAD) | ||||
| 
 | ||||
| cat >>confdefs.h <<_ACEOF | ||||
| #define HYPRE_DEVELOP_STRING "$develop_string" | ||||
| _ACEOF | ||||
| 
 | ||||
| 
 | ||||
| cat >>confdefs.h <<_ACEOF | ||||
| #define HYPRE_DEVELOP_NUMBER $develop_number | ||||
| _ACEOF | ||||
| 
 | ||||
|    if test "x$develop_branch" = "xmaster"; then : | ||||
| 
 | ||||
| cat >>confdefs.h <<_ACEOF | ||||
| #define HYPRE_DEVELOP_BRANCH "$develop_branch" | ||||
| _ACEOF | ||||
| 
 | ||||
| else | ||||
|   { $as_echo "$as_me:${as_lineno-$LINENO}: NOTE: On branch $develop_branch, not the main development branch" >&5 | ||||
| $as_echo "$as_me: NOTE: On branch $develop_branch, not the main development branch" >&6;} | ||||
| 
 | ||||
| fi | ||||
| else | ||||
|   { $as_echo "$as_me:${as_lineno-$LINENO}: NOTE: Could not find .git directory" >&5 | ||||
| $as_echo "$as_me: NOTE: Could not find .git directory" >&6;} | ||||
| 
 | ||||
| fi | ||||
| 
 | ||||
| 
 | ||||
| PACKAGE_DATE= | ||||
| PACKAGE_TIME= | ||||
| PACKAGE_DATETIME= | ||||
|  | ||||
							
								
								
									
										12
									
								
								src/test/TEST_ij/versioncheck.jobs
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										12
									
								
								src/test/TEST_ij/versioncheck.jobs
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,12 @@ | ||||
| #!/bin/sh | ||||
| # Copyright 1998-2019 Lawrence Livermore National Security, LLC and other | ||||
| # HYPRE Project Developers. See the top-level COPYRIGHT file for details. | ||||
| # | ||||
| # SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||||
| 
 | ||||
| #============================================================================= | ||||
| # Check the version header file variables | ||||
| #============================================================================= | ||||
| 
 | ||||
| mpirun -np 1 ./ij > versioncheck.out.1 | ||||
| 
 | ||||
							
								
								
									
										33
									
								
								src/test/TEST_ij/versioncheck.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										33
									
								
								src/test/TEST_ij/versioncheck.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,33 @@ | ||||
| #!/bin/sh | ||||
| # Copyright 1998-2019 Lawrence Livermore National Security, LLC and other | ||||
| # HYPRE Project Developers. See the top-level COPYRIGHT file for details. | ||||
| # | ||||
| # SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||||
| 
 | ||||
| TNAME=`basename $0 .sh` | ||||
| 
 | ||||
| #============================================================================= | ||||
| # Check the HYPRE_DEVELOP variables | ||||
| #============================================================================= | ||||
| 
 | ||||
| grep "Using HYPRE_DEVELOP_STRING" ${TNAME}.out.1 > ${TNAME}.testdata | ||||
| 
 | ||||
| if [ -d ../../../.git ]; then | ||||
|   DEVSTRING=`git describe --match 'v*' --long --abbrev=9` | ||||
|   DEVNUMBER=`echo $DEVSTRING | awk -F- '{print $2}'` | ||||
|   DEVBRANCH=`git rev-parse --abbrev-ref HEAD` | ||||
|   if [ -n "$DEVBRANCH" ]; then | ||||
|     echo "Using HYPRE_DEVELOP_STRING: $DEVSTRING (not main development branch)" \ | ||||
|      > ${TNAME}.testdatacheck | ||||
|   else | ||||
|     echo "Using HYPRE_DEVELOP_STRING: $DEVSTRING (main development branch $DEVBRANCH)" \ | ||||
|      > ${TNAME}.testdatacheck | ||||
|   fi | ||||
| fi | ||||
| diff ${TNAME}.testdata ${TNAME}.testdatacheck >&2 | ||||
| 
 | ||||
| #============================================================================= | ||||
| # remove temporary files | ||||
| #============================================================================= | ||||
| 
 | ||||
| rm -f ${TNAME}.testdata* | ||||
							
								
								
									
										12
									
								
								src/test/TEST_sstruct/versioncheck.jobs
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										12
									
								
								src/test/TEST_sstruct/versioncheck.jobs
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,12 @@ | ||||
| #!/bin/sh | ||||
| # Copyright 1998-2019 Lawrence Livermore National Security, LLC and other | ||||
| # HYPRE Project Developers. See the top-level COPYRIGHT file for details. | ||||
| # | ||||
| # SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||||
| 
 | ||||
| #============================================================================= | ||||
| # Check the version header file variables | ||||
| #============================================================================= | ||||
| 
 | ||||
| mpirun -np 1 ./sstruct > versioncheck.out.1 | ||||
| 
 | ||||
							
								
								
									
										33
									
								
								src/test/TEST_sstruct/versioncheck.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										33
									
								
								src/test/TEST_sstruct/versioncheck.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,33 @@ | ||||
| #!/bin/sh | ||||
| # Copyright 1998-2019 Lawrence Livermore National Security, LLC and other | ||||
| # HYPRE Project Developers. See the top-level COPYRIGHT file for details. | ||||
| # | ||||
| # SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||||
| 
 | ||||
| TNAME=`basename $0 .sh` | ||||
| 
 | ||||
| #============================================================================= | ||||
| # Check the HYPRE_DEVELOP variables | ||||
| #============================================================================= | ||||
| 
 | ||||
| grep "Using HYPRE_DEVELOP_STRING" ${TNAME}.out.1 > ${TNAME}.testdata | ||||
| 
 | ||||
| if [ -d ../../../.git ]; then | ||||
|   DEVSTRING=`git describe --match 'v*' --long --abbrev=9` | ||||
|   DEVNUMBER=`echo $DEVSTRING | awk -F- '{print $2}'` | ||||
|   DEVBRANCH=`git rev-parse --abbrev-ref HEAD` | ||||
|   if [ -n "$DEVBRANCH" ]; then | ||||
|     echo "Using HYPRE_DEVELOP_STRING: $DEVSTRING (not main development branch)" \ | ||||
|      > ${TNAME}.testdatacheck | ||||
|   else | ||||
|     echo "Using HYPRE_DEVELOP_STRING: $DEVSTRING (main development branch $DEVBRANCH)" \ | ||||
|      > ${TNAME}.testdatacheck | ||||
|   fi | ||||
| fi | ||||
| diff ${TNAME}.testdata ${TNAME}.testdatacheck >&2 | ||||
| 
 | ||||
| #============================================================================= | ||||
| # remove temporary files | ||||
| #============================================================================= | ||||
| 
 | ||||
| rm -f ${TNAME}.testdata* | ||||
							
								
								
									
										12
									
								
								src/test/TEST_struct/versioncheck.jobs
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										12
									
								
								src/test/TEST_struct/versioncheck.jobs
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,12 @@ | ||||
| #!/bin/sh | ||||
| # Copyright 1998-2019 Lawrence Livermore National Security, LLC and other | ||||
| # HYPRE Project Developers. See the top-level COPYRIGHT file for details. | ||||
| # | ||||
| # SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||||
| 
 | ||||
| #============================================================================= | ||||
| # Check the version header file variables | ||||
| #============================================================================= | ||||
| 
 | ||||
| mpirun -np 1 ./struct > versioncheck.out.1 | ||||
| 
 | ||||
							
								
								
									
										33
									
								
								src/test/TEST_struct/versioncheck.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										33
									
								
								src/test/TEST_struct/versioncheck.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,33 @@ | ||||
| #!/bin/sh | ||||
| # Copyright 1998-2019 Lawrence Livermore National Security, LLC and other | ||||
| # HYPRE Project Developers. See the top-level COPYRIGHT file for details. | ||||
| # | ||||
| # SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||||
| 
 | ||||
| TNAME=`basename $0 .sh` | ||||
| 
 | ||||
| #============================================================================= | ||||
| # Check the HYPRE_DEVELOP variables | ||||
| #============================================================================= | ||||
| 
 | ||||
| grep "Using HYPRE_DEVELOP_STRING" ${TNAME}.out.1 > ${TNAME}.testdata | ||||
| 
 | ||||
| if [ -d ../../../.git ]; then | ||||
|   DEVSTRING=`git describe --match 'v*' --long --abbrev=9` | ||||
|   DEVNUMBER=`echo $DEVSTRING | awk -F- '{print $2}'` | ||||
|   DEVBRANCH=`git rev-parse --abbrev-ref HEAD` | ||||
|   if [ -n "$DEVBRANCH" ]; then | ||||
|     echo "Using HYPRE_DEVELOP_STRING: $DEVSTRING (not main development branch)" \ | ||||
|      > ${TNAME}.testdatacheck | ||||
|   else | ||||
|     echo "Using HYPRE_DEVELOP_STRING: $DEVSTRING (main development branch $DEVBRANCH)" \ | ||||
|      > ${TNAME}.testdatacheck | ||||
|   fi | ||||
| fi | ||||
| diff ${TNAME}.testdata ${TNAME}.testdatacheck >&2 | ||||
| 
 | ||||
| #============================================================================= | ||||
| # remove temporary files | ||||
| #============================================================================= | ||||
| 
 | ||||
| rm -f ${TNAME}.testdata* | ||||
| @ -2194,6 +2194,15 @@ main( hypre_int argc, | ||||
| 
 | ||||
|    if (myid == 0) | ||||
|    { | ||||
| #ifdef HYPRE_DEVELOP_STRING | ||||
| #ifdef HYPRE_DEVELOP_BRANCH | ||||
|       hypre_printf("\nUsing HYPRE_DEVELOP_STRING: %s (main development branch %s)\n\n", | ||||
|          HYPRE_DEVELOP_STRING, HYPRE_DEVELOP_BRANCH); | ||||
| #else | ||||
|       hypre_printf("\nUsing HYPRE_DEVELOP_STRING: %s (not main development branch)\n\n", | ||||
|          HYPRE_DEVELOP_STRING); | ||||
| #endif | ||||
| #endif | ||||
|       hypre_printf("Running with these driver parameters:\n"); | ||||
|       hypre_printf("  solver ID    = %d\n\n", solver_id); | ||||
|    } | ||||
|  | ||||
| @ -2812,8 +2812,18 @@ main( hypre_int argc, | ||||
|    /*-----------------------------------------------------------
 | ||||
|     * Print driver parameters TODO | ||||
|     *-----------------------------------------------------------*/ | ||||
| 
 | ||||
|    if (myid == 0) | ||||
|    { | ||||
| #ifdef HYPRE_DEVELOP_STRING | ||||
| #ifdef HYPRE_DEVELOP_BRANCH | ||||
|       hypre_printf("\nUsing HYPRE_DEVELOP_STRING: %s (main development branch %s)\n\n", | ||||
|          HYPRE_DEVELOP_STRING, HYPRE_DEVELOP_BRANCH); | ||||
| #else | ||||
|       hypre_printf("\nUsing HYPRE_DEVELOP_STRING: %s (not main development branch)\n\n", | ||||
|          HYPRE_DEVELOP_STRING); | ||||
| #endif | ||||
| #endif | ||||
|    } | ||||
| 
 | ||||
|    /*-----------------------------------------------------------
 | ||||
|  | ||||
| @ -681,6 +681,15 @@ main( hypre_int argc, | ||||
| 
 | ||||
|    if (myid == 0 && sum == 0) | ||||
|    { | ||||
| #ifdef HYPRE_DEVELOP_STRING | ||||
| #ifdef HYPRE_DEVELOP_BRANCH | ||||
|       hypre_printf("\nUsing HYPRE_DEVELOP_STRING: %s (main development branch %s)\n\n", | ||||
|          HYPRE_DEVELOP_STRING, HYPRE_DEVELOP_BRANCH); | ||||
| #else | ||||
|       hypre_printf("\nUsing HYPRE_DEVELOP_STRING: %s (not main development branch)\n\n", | ||||
|          HYPRE_DEVELOP_STRING); | ||||
| #endif | ||||
| #endif | ||||
|       hypre_printf("Running with these driver parameters:\n"); | ||||
|       hypre_printf("  (nx, ny, nz)    = (%d, %d, %d)\n", nx, ny, nz); | ||||
|       hypre_printf("  (istart[0],istart[1],istart[2]) = (%d, %d, %d)\n", \ | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Rob Falgout
						Rob Falgout