Skip to content

Commit

Permalink
Merge pull request #630 from DrTimothyAldenDavis/dev2
Browse files Browse the repository at this point in the history
  • Loading branch information
DrTimothyAldenDavis authored Dec 24, 2023
2 parents 9c4bb11 + 5a94e7c commit 49cea0d
Show file tree
Hide file tree
Showing 32 changed files with 128 additions and 103 deletions.
2 changes: 1 addition & 1 deletion CHOLMOD/Demo/cholmod_demo.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define TRUE 1
#define FALSE 0

#define CPUTIME (SuiteSparse_time ( ))
#define CPUTIME SUITESPARSE_TIME

#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
Expand Down
12 changes: 6 additions & 6 deletions CHOLMOD/Demo/cholmod_di_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ int main (void)
}
b = cholmod_ones (A->nrow, 1, A->xtype + dtype, &c) ; // b = ones(n,1)

double t1 = SuiteSparse_time ( ) ;
double t1 = SUITESPARSE_TIME ;
L = cholmod_analyze (A, &c) ; // analyze
t1 = SuiteSparse_time ( ) - t1 ;
double t2 = SuiteSparse_time ( ) ;
t1 = SUITESPARSE_TIME - t1 ;
double t2 = SUITESPARSE_TIME ;
cholmod_factorize (A, L, &c) ; // factorize
t2 = SuiteSparse_time ( ) - t2 ;
double t3 = SuiteSparse_time ( ) ;
t2 = SUITESPARSE_TIME - t2 ;
double t3 = SUITESPARSE_TIME ;
x = cholmod_solve (CHOLMOD_A, L, b, &c) ; // solve Ax=b
t3 = SuiteSparse_time ( ) - t3 ;
t3 = SUITESPARSE_TIME - t3 ;
printf ("analyze time: %10.3f sec\n", t1) ;
printf ("factorize time: %10.3f sec\n", t2) ;
printf ("solve time: %10.3f sec\n", t3) ;
Expand Down
12 changes: 6 additions & 6 deletions CHOLMOD/Demo/cholmod_dl_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ int main (void)
}
b = cholmod_l_ones (A->nrow, 1, A->xtype + dtype, &c) ; // b = ones(n,1)

double t1 = SuiteSparse_time ( ) ;
double t1 = SUITESPARSE_TIME ;
L = cholmod_l_analyze (A, &c) ; // analyze
t1 = SuiteSparse_time ( ) - t1 ;
double t2 = SuiteSparse_time ( ) ;
t1 = SUITESPARSE_TIME - t1 ;
double t2 = SUITESPARSE_TIME ;
cholmod_l_factorize (A, L, &c) ; // factorize
t2 = SuiteSparse_time ( ) - t2 ;
double t3 = SuiteSparse_time ( ) ;
t2 = SUITESPARSE_TIME - t2 ;
double t3 = SUITESPARSE_TIME ;
x = cholmod_l_solve (CHOLMOD_A, L, b, &c) ; // solve Ax=b
t3 = SuiteSparse_time ( ) - t3 ;
t3 = SUITESPARSE_TIME - t3 ;
printf ("analyze time: %10.3f sec\n", t1) ;
printf ("factorize time: %10.3f sec\n", t2) ;
printf ("solve time: %10.3f sec\n", t3) ;
Expand Down
12 changes: 6 additions & 6 deletions CHOLMOD/Demo/cholmod_si_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ int main (void)
}
b = cholmod_ones (A->nrow, 1, A->xtype + dtype, &c) ; // b = ones(n,1)

double t1 = SuiteSparse_time ( ) ;
double t1 = SUITESPARSE_TIME ;
L = cholmod_analyze (A, &c) ; // analyze
t1 = SuiteSparse_time ( ) - t1 ;
double t2 = SuiteSparse_time ( ) ;
t1 = SUITESPARSE_TIME - t1 ;
double t2 = SUITESPARSE_TIME ;
cholmod_factorize (A, L, &c) ; // factorize
t2 = SuiteSparse_time ( ) - t2 ;
double t3 = SuiteSparse_time ( ) ;
t2 = SUITESPARSE_TIME - t2 ;
double t3 = SUITESPARSE_TIME ;
x = cholmod_solve (CHOLMOD_A, L, b, &c) ; // solve Ax=b
t3 = SuiteSparse_time ( ) - t3 ;
t3 = SUITESPARSE_TIME - t3 ;
printf ("analyze time: %10.3f sec\n", t1) ;
printf ("factorize time: %10.3f sec\n", t2) ;
printf ("solve time: %10.3f sec\n", t3) ;
Expand Down
12 changes: 6 additions & 6 deletions CHOLMOD/Demo/cholmod_sl_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ int main (void)
}
b = cholmod_l_ones (A->nrow, 1, A->xtype + dtype, &c) ; // b = ones(n,1)

double t1 = SuiteSparse_time ( ) ;
double t1 = SUITESPARSE_TIME ;
L = cholmod_l_analyze (A, &c) ; // analyze
t1 = SuiteSparse_time ( ) - t1 ;
double t2 = SuiteSparse_time ( ) ;
t1 = SUITESPARSE_TIME - t1 ;
double t2 = SUITESPARSE_TIME ;
cholmod_l_factorize (A, L, &c) ; // factorize
t2 = SuiteSparse_time ( ) - t2 ;
double t3 = SuiteSparse_time ( ) ;
t2 = SUITESPARSE_TIME - t2 ;
double t3 = SUITESPARSE_TIME ;
x = cholmod_l_solve (CHOLMOD_A, L, b, &c) ; // solve Ax=b
t3 = SuiteSparse_time ( ) - t3 ;
t3 = SUITESPARSE_TIME - t3 ;
printf ("analyze time: %10.3f sec\n", t1) ;
printf ("factorize time: %10.3f sec\n", t2) ;
printf ("solve time: %10.3f sec\n", t3) ;
Expand Down
9 changes: 0 additions & 9 deletions CHOLMOD/GPU/cholmod_gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,15 @@ static int poll_gpu (size_t s) /* TRUE if OK, FALSE otherwise */
/* Returns TRUE if the GPU has a block of memory of size s,
FALSE otherwise. The block of memory is immediately freed. */
void *p = NULL ;
// double t = SuiteSparse_time ( ) ;
if (s == 0)
{
return (FALSE) ;
}
if (cudaMalloc (&p, s) != cudaSuccess)
{
// t = SuiteSparse_time ( ) - t ;
// printf ("poll s %lu failed, time %g\n", s, t) ;
return (FALSE) ;
}
cudaFree (p) ;
// t = SuiteSparse_time ( ) - t ;
// printf ("poll s %lu OK time %g\n", s, t) ;
return (TRUE) ;
#else
return (FALSE) ;
Expand All @@ -74,7 +69,6 @@ int CHOLMOD(gpu_memorysize) /* returns 1 on error, 0 otherwise */
{
size_t good, bad, s, total_free, total_memory ;
int k ;
double t ;

*total_mem = 0;
*available_mem = 0;
Expand All @@ -90,10 +84,7 @@ int CHOLMOD(gpu_memorysize) /* returns 1 on error, 0 otherwise */
#ifdef CHOLMOD_HAS_CUDA

/* find the total amount of free memory */
t = SuiteSparse_time ( ) ;
cudaMemGetInfo (&total_free, &total_memory) ;
t = SuiteSparse_time ( ) - t ;
// printf ("free %lu tot %lu time %g\n", total_free, total_memory, t) ;

*total_mem = total_memory;

Expand Down
16 changes: 8 additions & 8 deletions CHOLMOD/GPU/t_cholmod_gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ int TEMPLATE2 (CHOLMOD (gpu_updateC))
ndrow3 = ndrow2 - ndrow1 ;

#ifdef BLAS_TIMER
Common->syrkStart = SuiteSparse_time ( ) ;
Common->syrkStart = SUITESPARSE_TIME ;
Common->CHOLMOD_GPU_SYRK_CALLS++ ;
#endif

Expand Down Expand Up @@ -532,7 +532,7 @@ int TEMPLATE2 (CHOLMOD (gpu_updateC))
}

#ifdef BLAS_TIMER
Common->CHOLMOD_GPU_SYRK_TIME += SuiteSparse_time() - Common->syrkStart;
Common->CHOLMOD_GPU_SYRK_TIME += SUITESPARSE_TIME - Common->syrkStart;
#endif

/* ---------------------------------------------------------------------- */
Expand All @@ -541,7 +541,7 @@ int TEMPLATE2 (CHOLMOD (gpu_updateC))

#ifdef BLAS_TIMER
Common->CHOLMOD_GPU_GEMM_CALLS++ ;
tstart = SuiteSparse_time();
tstart = SUITESPARSE_TIME;
#endif

if (ndrow3 > 0)
Expand Down Expand Up @@ -591,7 +591,7 @@ int TEMPLATE2 (CHOLMOD (gpu_updateC))
}

#ifdef BLAS_TIMER
Common->CHOLMOD_GPU_GEMM_TIME += SuiteSparse_time() - tstart;
Common->CHOLMOD_GPU_GEMM_TIME += SUITESPARSE_TIME - tstart;
#endif

/* ------------------------------------------------------------------ */
Expand Down Expand Up @@ -812,7 +812,7 @@ int TEMPLATE2 (CHOLMOD (gpu_lower_potrf))
}

#ifdef BLAS_TIMER
tstart = SuiteSparse_time ( ) ;
tstart = SUITESPARSE_TIME ;
Common->CHOLMOD_GPU_POTRF_CALLS++ ;
#endif

Expand Down Expand Up @@ -1130,7 +1130,7 @@ int TEMPLATE2 (CHOLMOD (gpu_lower_potrf))
}

#ifdef BLAS_TIMER
Common->CHOLMOD_GPU_POTRF_TIME += SuiteSparse_time ( ) - tstart ;
Common->CHOLMOD_GPU_POTRF_TIME += SUITESPARSE_TIME - tstart ;
#endif

return (1) ;
Expand Down Expand Up @@ -1193,7 +1193,7 @@ int TEMPLATE2 (CHOLMOD (gpu_triangular_solve))
}

#ifdef BLAS_TIMER
tstart = SuiteSparse_time ( ) ;
tstart = SUITESPARSE_TIME ;
Common->CHOLMOD_GPU_TRSM_CALLS++ ;
#endif

Expand Down Expand Up @@ -1388,7 +1388,7 @@ int TEMPLATE2 (CHOLMOD (gpu_triangular_solve))
/* ---------------------------------------------------------------------- */

#ifdef BLAS_TIMER
Common->CHOLMOD_GPU_TRSM_TIME += SuiteSparse_time ( ) - tstart ;
Common->CHOLMOD_GPU_TRSM_TIME += SUITESPARSE_TIME - tstart ;
#endif

return (1) ;
Expand Down
16 changes: 8 additions & 8 deletions CHOLMOD/Supernodal/t_cholmod_super_numeric_worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ static int TEMPLATE (cholmod_super_numeric_worker)

#ifdef BLAS_TIMER
Common->CHOLMOD_CPU_SYRK_CALLS++ ;
tstart = SuiteSparse_time () ;
tstart = SUITESPARSE_TIME ;
#endif

#if (defined (DOUBLE) && defined (REAL))
Expand Down Expand Up @@ -803,7 +803,7 @@ static int TEMPLATE (cholmod_super_numeric_worker)
#endif

#ifdef BLAS_TIMER
blas_time = SuiteSparse_time () - tstart ;
blas_time = SUITESPARSE_TIME - tstart ;
Common->CHOLMOD_CPU_SYRK_TIME += blas_time ;
BLAS_DUMP_TO_FILE (0, // dsyrk ("L", "N", ...)
ndrow1, ndcol, 0, // N, K, 0
Expand All @@ -817,7 +817,7 @@ static int TEMPLATE (cholmod_super_numeric_worker)

#ifdef BLAS_TIMER
Common->CHOLMOD_CPU_GEMM_CALLS++ ;
tstart = SuiteSparse_time () ;
tstart = SUITESPARSE_TIME ;
#endif

#if (defined (DOUBLE) && defined (REAL))
Expand Down Expand Up @@ -874,7 +874,7 @@ static int TEMPLATE (cholmod_super_numeric_worker)
#endif

#ifdef BLAS_TIMER
blas_time = SuiteSparse_time () - tstart ;
blas_time = SUITESPARSE_TIME - tstart ;
Common->CHOLMOD_CPU_GEMM_TIME += blas_time ;
BLAS_DUMP_TO_FILE (4, // dgemm ("N", "C", ...)
ndrow3, ndrow1, ndcol, // M, N, K
Expand Down Expand Up @@ -1016,7 +1016,7 @@ static int TEMPLATE (cholmod_super_numeric_worker)
#endif
#ifdef BLAS_TIMER
Common->CHOLMOD_CPU_POTRF_CALLS++ ;
tstart = SuiteSparse_time () ;
tstart = SUITESPARSE_TIME ;
#endif

#if (defined (DOUBLE) && defined (REAL))
Expand Down Expand Up @@ -1049,7 +1049,7 @@ static int TEMPLATE (cholmod_super_numeric_worker)
#endif

#ifdef BLAS_TIMER
blas_time = SuiteSparse_time () - tstart ;
blas_time = SUITESPARSE_TIME - tstart ;
Common->CHOLMOD_CPU_POTRF_TIME += blas_time ;
BLAS_DUMP_TO_FILE (8, // dpotrf ("L", ... )
nscol2, 0, 0, // N, 0, 0
Expand Down Expand Up @@ -1168,7 +1168,7 @@ static int TEMPLATE (cholmod_super_numeric_worker)
{
#ifdef BLAS_TIMER
Common->CHOLMOD_CPU_TRSM_CALLS++ ;
tstart = SuiteSparse_time () ;
tstart = SUITESPARSE_TIME ;
#endif

#if (defined (DOUBLE) && defined (REAL))
Expand Down Expand Up @@ -1209,7 +1209,7 @@ static int TEMPLATE (cholmod_super_numeric_worker)
#endif

#ifdef BLAS_TIMER
blas_time = SuiteSparse_time () - tstart ;
blas_time = SUITESPARSE_TIME - tstart ;
Common->CHOLMOD_CPU_TRSM_TIME += blas_time ;
BLAS_DUMP_TO_FILE (12, // dtrsm ("R", "L", "C", "N"...)
nsrow2, nscol2, 0, // M, N
Expand Down
3 changes: 2 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ Dec 30, 2023: version 7.4.0
bug fixes in the GPU Module.
* AMD 3.3.0: minor change for CHOLMOD 5.1.0 tests
* CAMD 3.3.0: minor change for CHOLMOD 5.1.0 tests
* SuiteSparse_config 7.4.0: added wrappers for single-precision BLAS/LAPACK
* SuiteSparse_config 7.4.0: added wrappers for single-precision BLAS/LAPACK,
added SUITESPARSE_TIME macro.
* *_version: added methods to all package that didn't have them:
AMD, CAMD, COLAMD, CCOLAMD, BTF, CSparse, CXSparse, KLU, BTF, RBio,
SPEX, SPQR, and UMFPACK.
Expand Down
8 changes: 4 additions & 4 deletions Mongoose/Demo/demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ int main(int argn, const char **argv)
cout << "Mongoose is licensed under Version 3 of the GNU General Public License." << endl;
cout << "Mongoose is also available under other licenses; contact authors for details." << endl;

double start = SuiteSparse_time ();
double start = SUITESPARSE_TIME;
double duration;

for (int k = 0; k < NMAT; k++)
{
cout << "********************************************************************************" << endl;
cout << "Computing an edge cut for " << demo_files[k] << "..." << endl;

double trial_start = SuiteSparse_time ();
double trial_start = SUITESPARSE_TIME;
EdgeCut_Options *options = EdgeCut_Options::create();
if (!options) return EXIT_FAILURE; // Return an error if we failed.

Expand All @@ -87,15 +87,15 @@ int main(int argn, const char **argv)
cout << "Cut Imbalance: " << setprecision(2) << 100*(result->imbalance) << "%" << endl;
}

double trial_duration = (SuiteSparse_time() - trial_start) ;
double trial_duration = (SUITESPARSE_TIME - trial_start) ;
cout << "Trial Time: " << trial_duration*1000 << "ms" << endl;

options->~EdgeCut_Options();
graph->~Graph();
result->~EdgeCut();
}

duration = (SuiteSparse_time() - start) ;
duration = (SUITESPARSE_TIME - start) ;

cout << "********************************************************************************" << endl;
cout << "Total Demo Time: " << setprecision(2) << duration << "s" << endl;
Expand Down
4 changes: 2 additions & 2 deletions Mongoose/Executable/mongoose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ int main(int argn, const char **argv)
std::cout << "********************************************************************************" << std::endl;

// An edge separator should be computed with default options
t = SuiteSparse_time ();
t = SUITESPARSE_TIME;
EdgeCut *result = edge_cut(graph, options);
t = SuiteSparse_time () - t;
t = SUITESPARSE_TIME - t;

if (!result)
{
Expand Down
4 changes: 2 additions & 2 deletions Mongoose/Include/Mongoose_Logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ inline void Logger::tic(TimingType timingType)
{
if (timingOn)
{
clocks[timingType] = SuiteSparse_time ();
clocks[timingType] = SUITESPARSE_TIME;
}
}

Expand All @@ -157,7 +157,7 @@ inline void Logger::toc(TimingType timingType)
if (timingOn)
{
times[timingType]
+= (float) (SuiteSparse_time () - clocks[timingType]) ;
+= (float) (SUITESPARSE_TIME - clocks[timingType]) ;
}
}

Expand Down
4 changes: 2 additions & 2 deletions Mongoose/Tests/Mongoose_Test_Performance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ int runPerformanceTest(const std::string &inputFile, const std::string &outputFi
}

// An edge separator should be computed with default options
t = SuiteSparse_time ();
t = SUITESPARSE_TIME;
EdgeCut *result = edge_cut(graph, options);
t = SuiteSparse_time () - t;
t = SUITESPARSE_TIME - t;

if (!result)
{
Expand Down
4 changes: 2 additions & 2 deletions Mongoose/Tests/Mongoose_Test_Reference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ int runReferenceTest(const std::string &inputFile)
}

// An edge separator should be computed with default options
t = SuiteSparse_time ();
t = SUITESPARSE_TIME;
EdgeCut *result = edge_cut(graph, options);
t = SuiteSparse_time () - t;
t = SUITESPARSE_TIME - t;

if (!result)
{
Expand Down
4 changes: 2 additions & 2 deletions SPQR/Demo/qrdemo_gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ int main (int argc, char **argv)
// warmup the GPU. This can take some time, but only needs
// to be done once
cc->useGPU = true ;
t = SuiteSparse_time ( ) ;
t = SUITESPARSE_TIME ;
cholmod_l_gpu_memorysize (&total_mem, &available_mem, cc) ;
cc->gpuMemorySize = available_mem ;
t = SuiteSparse_time ( ) - t ;
t = SUITESPARSE_TIME - t ;
if (cc->gpuMemorySize <= 1)
{
printf ("no GPU available\n") ;
Expand Down
Loading

0 comments on commit 49cea0d

Please sign in to comment.