Skip to content

Commit

Permalink
Change type of paru_max_threads from int64_t to int32_t
Browse files Browse the repository at this point in the history
  • Loading branch information
gruenich committed Nov 19, 2023
1 parent 7784361 commit a684309
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ParU/Include/ParU.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ struct ParU_Control
int64_t trivial = 4; //dgemms with sizes less than trivial doesn't call BLAS
int64_t worthwhile_dgemm = 512; // dgemms bigger than worthwhile are tasked
int64_t worthwhile_trsm = 4096; // trsm bigger than worthwhile are tasked
int64_t paru_max_threads = 0; //It will be initialized with omp_max_threads
int32_t paru_max_threads = 0; //It will be initialized with omp_max_threads
// if the user do not provide a smaller number
};
// =============================================================================
Expand Down
2 changes: 1 addition & 1 deletion ParU/Include/ParU_C.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ typedef struct ParU_C_Control_struct
int64_t trivial; // dgemms with sizes less than trivial doesn't call BLAS
int64_t worthwhile_dgemm; // dgemms bigger than worthwhile are tasked
int64_t worthwhile_trsm; // trsm bigger than worthwhile are tasked
int64_t paru_max_threads; // It will be initialized with omp_max_threads
int32_t paru_max_threads; // It will be initialized with omp_max_threads
// if the user do not provide a smaller number
} ParU_C_Control;

Expand Down
4 changes: 2 additions & 2 deletions ParU/Source/paru_assemble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void paru_assemble_all(int64_t e, int64_t f, std::vector<int64_t> &colHash,
#pragma omp atomic read
naft = Work->naft;
ParU_Control *Control = Num->Control;
const int64_t max_threads = Control->paru_max_threads;
const int32_t max_threads = Control->paru_max_threads;

if (el->nrowsleft * el->ncolsleft < 4096 || el->nrowsleft < 1024
#ifndef PARU_COVERAGE
Expand Down Expand Up @@ -357,7 +357,7 @@ void paru_assemble_cols(int64_t e, int64_t f, std::vector<int64_t> &colHash,
// int64_t naft; //number of active frontal tasks
// pragma omp atomic read
// naft = Num->naft;
// const int64_t max_threads = Num->paru_max_threads;
// const int32_t max_threads = Num->paru_max_threads;
////int64_t *Depth = Sym->Depth;
// pragma omp parallel proc_bind(close) num_threads(max_threads/naft)
// if (naft < max_threads/2 &&
Expand Down
4 changes: 2 additions & 2 deletions ParU/Source/paru_factorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ ParU_Ret ParU_Factorize(cholmod_sparse *A, ParU_Symbolic *Sym,
if (worthwhile_dgemm < 0) my_Control.worthwhile_dgemm = 512;
int64_t worthwhile_trsm = my_Control.worthwhile_trsm;
if (worthwhile_trsm < 0) my_Control.worthwhile_trsm = 4096;
int64_t max_threads = PARU_OPENMP_MAX_THREADS;
int32_t max_threads = PARU_OPENMP_MAX_THREADS;
if (my_Control.paru_max_threads > 0)
my_Control.paru_max_threads =
std::min(max_threads, my_Control.paru_max_threads);
Expand Down Expand Up @@ -346,7 +346,7 @@ ParU_Ret ParU_Factorize(cholmod_sparse *A, ParU_Symbolic *Sym,
#if ! defined ( PARU_GCC_WINDOWS )
// The parallel factorization gets stuck intermittently on Windows with GCC.
// Use the sequential factorization unconditionally in that case.
if ((int64_t)task_Q.size() * 2 > Control->paru_max_threads)
if (task_Q.size() * 2 > Control->paru_max_threads)
{
printf ("Parallel:\n") ; // FIXME
PRLEVEL(1, ("Parallel\n"));
Expand Down
2 changes: 1 addition & 1 deletion ParU/Source/paru_fs_factorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void paru_swap_rows(double *F, int64_t *frowList, int64_t m, int64_t n, int64_t
// int64_t naft; //number of active frontal tasks
// pragma omp atomic read
// naft = Num->naft;
// const int64_t max_threads = Control->paru_max_threads;
// const int32_t max_threads = Control->paru_max_threads;
// if ( (naft == 1) && (n > 1024) )
// printf ("naft=" LD ", max_threads=" LD " num_tasks=" LD " n =" LD " \n",
// naft, max_threads, max_threads/(naft), n);
Expand Down
2 changes: 1 addition & 1 deletion ParU/Source/paru_internal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ inline int32_t control_nthreads (ParU_Control *Control)
}
else
{
return std::min(max_threads, static_cast<int32_t>(Control->paru_max_threads));
return std::min(max_threads, Control->paru_max_threads);
}
}

Expand Down
2 changes: 1 addition & 1 deletion ParU/Source/paru_tasked_dgemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int64_t paru_tasked_dgemm(int64_t f, int64_t M, int64_t N, int64_t K,
int64_t L = Control->worthwhile_dgemm;
#pragma omp atomic read
naft = Work->naft;
const int64_t max_threads = Control->paru_max_threads;
const int32_t max_threads = Control->paru_max_threads;
if (naft == 1)
{
BLAS_set_num_threads(max_threads);
Expand Down
2 changes: 1 addition & 1 deletion ParU/Source/paru_tasked_trsm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int64_t paru_tasked_trsm(int64_t f, int64_t m, int64_t n, double alpha, double *
#endif
#pragma omp atomic read
naft = Work->naft;
const int64_t max_threads = Control->paru_max_threads;
const int32_t max_threads = Control->paru_max_threads;
if (naft == 1)
{
BLAS_set_num_threads(max_threads);
Expand Down

0 comments on commit a684309

Please sign in to comment.