Skip to content

Commit

Permalink
Merge pull request #590 from DrTimothyAldenDavis/dev2
Browse files Browse the repository at this point in the history
set RPATH, other minor cleanup
  • Loading branch information
DrTimothyAldenDavis authored Dec 14, 2023
2 parents ba76e08 + 39e6538 commit 616c50b
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ jobs:
done
- name: check
timeout-minutes: 20
timeout-minutes: 40
run: |
IFS=':' read -r -a libs <<< "${CHECK_LIBS}"
for lib in "${libs[@]}"; do
Expand Down
26 changes: 22 additions & 4 deletions GraphBLAS/cmake_modules/SuiteSparsePolicy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,15 @@ endif ( )

# add the ./build folder to the runpath so other SuiteSparse packages can
# find this one without "make install"
set ( CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} ${CMAKE_BINARY_DIR} )
list ( FIND CMAKE_BUILD_RPATH ${CMAKE_BINARY_DIR} _idx )
if ( _idx LESS 0 )
# not yet included in CMAKE_INSTALL_RPATH
list ( APPEND CMAKE_BUILD_RPATH ${CMAKE_BINARY_DIR} )
endif ( )

set ( INSIDE_SUITESPARSE OFF )
if ( NOT SUITESPARSE_ROOT_CMAKELISTS )
# determine if this Package is inside the SuiteSparse folder
set ( INSIDE_SUITESPARSE false )
if ( LOCAL_INSTALL )
# if you do not want to install local copies of SuiteSparse
# packages in SuiteSparse/lib and SuiteSparse/, set
Expand Down Expand Up @@ -199,18 +203,32 @@ if ( LOCAL_INSTALL )
endif ( )
endif ( )
set ( SUITESPARSE_LIBDIR ${SUITESPARSE_LOCAL_PREFIX}/lib )
set ( SUITESPARSE_FULL_LIBDIR ${SUITESPARSE_LIBDIR} )
set ( SUITESPARSE_INCLUDEDIR ${SUITESPARSE_LOCAL_PREFIX}/include/${SUITESPARSE_INCLUDEDIR_POSTFIX} )
set ( SUITESPARSE_BINDIR ${SUITESPARSE_LOCAL_PREFIX}/bin )
else ( )
set ( SUITESPARSE_LIBDIR ${CMAKE_INSTALL_LIBDIR} )
set ( SUITESPARSE_FULL_LIBDIR ${CMAKE_INSTALL_FULL_LIBDIR} )
set ( SUITESPARSE_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}/${SUITESPARSE_INCLUDEDIR_POSTFIX} )
set ( SUITESPARSE_BINDIR ${CMAKE_INSTALL_BINDIR} )
endif ( )

if ( INSIDE_SUITESPARSE )
# append ../lib to the install and build runpaths
set ( CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${SUITESPARSE_LIBDIR} )
set ( CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} ${SUITESPARSE_LIBDIR} )
list ( APPEND CMAKE_INSTALL_RPATH ${SUITESPARSE_FULL_LIBDIR} )
list ( APPEND CMAKE_BUILD_RPATH ${SUITESPARSE_LIBDIR} )
else ( )
# Set reasonable RPATH for installed binaries
# That should be fine as long as DESTDIR isn't set when installing.
list ( FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${SUITESPARSE_FULL_LIBDIR} _idx )
if ( _idx LESS 0 )
# installation is not to a system prefix
list ( FIND CMAKE_INSTALL_RPATH ${SUITESPARSE_FULL_LIBDIR} _idx )
if ( _idx LESS 0 )
# RPATH is not yet included in CMAKE_INSTALL_RPATH
list ( APPEND CMAKE_INSTALL_RPATH ${SUITESPARSE_FULL_LIBDIR} )
endif ( )
endif ( )
endif ( )

set ( SUITESPARSE_PKGFILEDIR ${SUITESPARSE_LIBDIR} CACHE STRING
Expand Down
26 changes: 22 additions & 4 deletions LAGraph/cmake_modules/SuiteSparsePolicy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,15 @@ endif ( )

# add the ./build folder to the runpath so other SuiteSparse packages can
# find this one without "make install"
set ( CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} ${CMAKE_BINARY_DIR} )
list ( FIND CMAKE_BUILD_RPATH ${CMAKE_BINARY_DIR} _idx )
if ( _idx LESS 0 )
# not yet included in CMAKE_INSTALL_RPATH
list ( APPEND CMAKE_BUILD_RPATH ${CMAKE_BINARY_DIR} )
endif ( )

set ( INSIDE_SUITESPARSE OFF )
if ( NOT SUITESPARSE_ROOT_CMAKELISTS )
# determine if this Package is inside the SuiteSparse folder
set ( INSIDE_SUITESPARSE false )
if ( LOCAL_INSTALL )
# if you do not want to install local copies of SuiteSparse
# packages in SuiteSparse/lib and SuiteSparse/, set
Expand Down Expand Up @@ -199,18 +203,32 @@ if ( LOCAL_INSTALL )
endif ( )
endif ( )
set ( SUITESPARSE_LIBDIR ${SUITESPARSE_LOCAL_PREFIX}/lib )
set ( SUITESPARSE_FULL_LIBDIR ${SUITESPARSE_LIBDIR} )
set ( SUITESPARSE_INCLUDEDIR ${SUITESPARSE_LOCAL_PREFIX}/include/${SUITESPARSE_INCLUDEDIR_POSTFIX} )
set ( SUITESPARSE_BINDIR ${SUITESPARSE_LOCAL_PREFIX}/bin )
else ( )
set ( SUITESPARSE_LIBDIR ${CMAKE_INSTALL_LIBDIR} )
set ( SUITESPARSE_FULL_LIBDIR ${CMAKE_INSTALL_FULL_LIBDIR} )
set ( SUITESPARSE_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}/${SUITESPARSE_INCLUDEDIR_POSTFIX} )
set ( SUITESPARSE_BINDIR ${CMAKE_INSTALL_BINDIR} )
endif ( )

if ( INSIDE_SUITESPARSE )
# append ../lib to the install and build runpaths
set ( CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${SUITESPARSE_LIBDIR} )
set ( CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} ${SUITESPARSE_LIBDIR} )
list ( APPEND CMAKE_INSTALL_RPATH ${SUITESPARSE_FULL_LIBDIR} )
list ( APPEND CMAKE_BUILD_RPATH ${SUITESPARSE_LIBDIR} )
else ( )
# Set reasonable RPATH for installed binaries
# That should be fine as long as DESTDIR isn't set when installing.
list ( FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${SUITESPARSE_FULL_LIBDIR} _idx )
if ( _idx LESS 0 )
# installation is not to a system prefix
list ( FIND CMAKE_INSTALL_RPATH ${SUITESPARSE_FULL_LIBDIR} _idx )
if ( _idx LESS 0 )
# RPATH is not yet included in CMAKE_INSTALL_RPATH
list ( APPEND CMAKE_INSTALL_RPATH ${SUITESPARSE_FULL_LIBDIR} )
endif ( )
endif ( )
endif ( )

set ( SUITESPARSE_PKGFILEDIR ${SUITESPARSE_LIBDIR} CACHE STRING
Expand Down
25 changes: 0 additions & 25 deletions LAGraph/src/algorithm/LG_CC_FastSV6.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,6 @@ int LG_CC_FastSV6 // SuiteSparse:GraphBLAS method, with GxB extensions
bool T_jumbled, T_iso ;
GRB_TRY (GxB_Matrix_unpack_CSR (T, &Tp, &Tj, &Tx, &Tp_size, &Tj_size,
&Tx_size, &T_iso, &T_jumbled, NULL)) ;
// printf ("did unpack T\n") ; fflush (stdout) ; fflush (stderr) ;
#pragma omp parallel for num_threads(nthreads) schedule(static)
for (tid = 0 ; tid < nthreads ; tid++)
{
Expand Down Expand Up @@ -601,33 +600,15 @@ int LG_CC_FastSV6 // SuiteSparse:GraphBLAS method, with GxB extensions
count [tid] = p - Tp [range [tid]] ;
}

// printf ("did prune T\n") ; fflush (stdout) ; fflush (stderr) ;

// Compact empty space out of Tj not filled in from the above phase.
nvals = 0 ;
for (tid = 0 ; tid < nthreads ; tid++)
{
// `memcpy` is not safe if src/dest are overlapping.
// Use `memmove` (or if available `memmove_s`) instead.

// #if defined (__STDC_LIB_EXT1__)
// memmove_s (Tj + nvals, Tj_size - sizeof (GrB_Index) * nvals,
// Tj + Tp [range [tid]], sizeof (GrB_Index) * count [tid]) ;
// #else

// memmove is safe: src/dest can overlap, but the copy will not go
// outside of the array, and Tj is never NULL at this point
// (GRB_TRY on the GxB_Matrix_unpack_CSR above would catch that
// condition). So memmove_s isn't necessary.
memmove (Tj + nvals,
Tj + Tp [range [tid]], sizeof (GrB_Index) * count [tid]) ;

// #endif

nvals += count [tid] ;
count [tid] = nvals - count [tid] ;
}
// printf ("did compact T\n") ; fflush (stdout) ; fflush (stderr) ;

// Compact empty space out of Tp
#pragma omp parallel for num_threads(nthreads) schedule(static)
Expand All @@ -640,23 +621,17 @@ int LG_CC_FastSV6 // SuiteSparse:GraphBLAS method, with GxB extensions
}
}

// printf ("did 2nd compact T\n") ; fflush (stdout) ; fflush (stderr) ;

// finalize T
Tp [n] = nvals ;

// pack T for the final phase
GRB_TRY (GxB_Matrix_pack_CSR (T, &Tp, &Tj, &Tx, Tp_size, Tj_size,
Tx_size, T_iso, /* T is now jumbled */ true, NULL)) ;

// printf ("did pack T\n") ; fflush (stdout) ; fflush (stderr) ;

// pack A (unchanged since last unpack); this is the original G->A.
GRB_TRY (GxB_Matrix_pack_CSR (A, &Ap, &Aj, &Ax, Ap_size, Aj_size,
Ax_size, A_iso, A_jumbled, NULL)) ;

// printf ("did pack A\n") ; fflush (stdout) ; fflush (stderr) ;

// ]. The unpack/pack of A into Ap, Aj, Ax will not be needed, and G->A
// will become truly a read-only matrix.

Expand Down
26 changes: 22 additions & 4 deletions SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,15 @@ endif ( )

# add the ./build folder to the runpath so other SuiteSparse packages can
# find this one without "make install"
set ( CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} ${CMAKE_BINARY_DIR} )
list ( FIND CMAKE_BUILD_RPATH ${CMAKE_BINARY_DIR} _idx )
if ( _idx LESS 0 )
# not yet included in CMAKE_INSTALL_RPATH
list ( APPEND CMAKE_BUILD_RPATH ${CMAKE_BINARY_DIR} )
endif ( )

set ( INSIDE_SUITESPARSE OFF )
if ( NOT SUITESPARSE_ROOT_CMAKELISTS )
# determine if this Package is inside the SuiteSparse folder
set ( INSIDE_SUITESPARSE false )
if ( LOCAL_INSTALL )
# if you do not want to install local copies of SuiteSparse
# packages in SuiteSparse/lib and SuiteSparse/, set
Expand Down Expand Up @@ -199,18 +203,32 @@ if ( LOCAL_INSTALL )
endif ( )
endif ( )
set ( SUITESPARSE_LIBDIR ${SUITESPARSE_LOCAL_PREFIX}/lib )
set ( SUITESPARSE_FULL_LIBDIR ${SUITESPARSE_LIBDIR} )
set ( SUITESPARSE_INCLUDEDIR ${SUITESPARSE_LOCAL_PREFIX}/include/${SUITESPARSE_INCLUDEDIR_POSTFIX} )
set ( SUITESPARSE_BINDIR ${SUITESPARSE_LOCAL_PREFIX}/bin )
else ( )
set ( SUITESPARSE_LIBDIR ${CMAKE_INSTALL_LIBDIR} )
set ( SUITESPARSE_FULL_LIBDIR ${CMAKE_INSTALL_FULL_LIBDIR} )
set ( SUITESPARSE_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}/${SUITESPARSE_INCLUDEDIR_POSTFIX} )
set ( SUITESPARSE_BINDIR ${CMAKE_INSTALL_BINDIR} )
endif ( )

if ( INSIDE_SUITESPARSE )
# append ../lib to the install and build runpaths
set ( CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${SUITESPARSE_LIBDIR} )
set ( CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} ${SUITESPARSE_LIBDIR} )
list ( APPEND CMAKE_INSTALL_RPATH ${SUITESPARSE_FULL_LIBDIR} )
list ( APPEND CMAKE_BUILD_RPATH ${SUITESPARSE_LIBDIR} )
else ( )
# Set reasonable RPATH for installed binaries
# That should be fine as long as DESTDIR isn't set when installing.
list ( FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${SUITESPARSE_FULL_LIBDIR} _idx )
if ( _idx LESS 0 )
# installation is not to a system prefix
list ( FIND CMAKE_INSTALL_RPATH ${SUITESPARSE_FULL_LIBDIR} _idx )
if ( _idx LESS 0 )
# RPATH is not yet included in CMAKE_INSTALL_RPATH
list ( APPEND CMAKE_INSTALL_RPATH ${SUITESPARSE_FULL_LIBDIR} )
endif ( )
endif ( )
endif ( )

set ( SUITESPARSE_PKGFILEDIR ${SUITESPARSE_LIBDIR} CACHE STRING
Expand Down

0 comments on commit 616c50b

Please sign in to comment.