Default number of threads in scatsystem.c set to 4, debug messages.
Former-commit-id: da244d95534eabe2be07327ba174467935518a12
This commit is contained in:
parent
5b49dfc8d0
commit
f23edf0d71
|
@ -27,6 +27,8 @@ void qpms_pr_debug_at_flf(const char *filename, unsigned int linenum,
|
||||||
|
|
||||||
#define QPMS_WARN(msg, ...) qpms_warn_at_flf(__FILE__,__LINE__,__func__,msg, ##__VA_ARGS__)
|
#define QPMS_WARN(msg, ...) qpms_warn_at_flf(__FILE__,__LINE__,__func__,msg, ##__VA_ARGS__)
|
||||||
|
|
||||||
|
#define QPMS_DEBUG(msg, ...) qpms_pr_debug_at_flf(__FILE__,__LINE__,__func__,msg, ##__VA_ARGS__)
|
||||||
|
|
||||||
#define QPMS_CRASHING_MALLOC(pointer, size) {(pointer) = malloc(size); if(!pointer && (size)) qpms_pr_debug_at_flf(__FILE__,__LINE__,__func__, "Allocation of %zd bytes for " #pointer " failed.", (size_t) (size));}
|
#define QPMS_CRASHING_MALLOC(pointer, size) {(pointer) = malloc(size); if(!pointer && (size)) qpms_pr_debug_at_flf(__FILE__,__LINE__,__func__, "Allocation of %zd bytes for " #pointer " failed.", (size_t) (size));}
|
||||||
|
|
||||||
#define QPMS_CRASHING_REALLOC(pointer, size) {(pointer) = realloc(pointer, size); if(!pointer && (size)) qpms_pr_debug_at_flf(__FILE__,__LINE__,__func__, "Rellocation of %zd bytes for " #pointer " failed.", (size_t) (size));}
|
#define QPMS_CRASHING_REALLOC(pointer, size) {(pointer) = realloc(pointer, size); if(!pointer && (size)) qpms_pr_debug_at_flf(__FILE__,__LINE__,__func__, "Rellocation of %zd bytes for " #pointer " failed.", (size_t) (size));}
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#define QPMS_SCATSYS_TMATRIX_ATOL 1e-14
|
#define QPMS_SCATSYS_TMATRIX_ATOL 1e-14
|
||||||
#define QPMS_SCATSYS_TMATRIX_RTOL 1e-12
|
#define QPMS_SCATSYS_TMATRIX_RTOL 1e-12
|
||||||
|
|
||||||
|
long qpms_scatsystem_nthreads_default = 4;
|
||||||
|
|
||||||
// ------------ Stupid implementation of qpms_scatsys_apply_symmetry() -------------
|
// ------------ Stupid implementation of qpms_scatsys_apply_symmetry() -------------
|
||||||
|
|
||||||
#define MIN(x,y) (((x)<(y))?(x):(y))
|
#define MIN(x,y) (((x)<(y))?(x):(y))
|
||||||
|
@ -1418,8 +1420,13 @@ complex double *qpms_scatsys_build_modeproblem_matrix_irrep_packed_parallelR(
|
||||||
|
|
||||||
// FIXME THIS IS NOT PORTABLE:
|
// FIXME THIS IS NOT PORTABLE:
|
||||||
long nthreads = sysconf(_SC_NPROCESSORS_ONLN);
|
long nthreads = sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
if (nthreads < 1) nthreads = 1; // If something goes wrong...
|
if (nthreads < 1) {
|
||||||
|
QPMS_WARN("_SC_NPROCESSORS_ONLN returned %ld, using %ld thread(s) instead.",
|
||||||
|
nthreads, qpms_scatsystem_nthreads_default);
|
||||||
|
nthreads = qpms_scatsystem_nthreads_default;
|
||||||
|
} else {
|
||||||
|
QPMS_DEBUG("_SC_NRPOCESSORS_ONLN returned %ld.", nthreads);
|
||||||
|
}
|
||||||
pthread_t thread_ids[nthreads];
|
pthread_t thread_ids[nthreads];
|
||||||
for(long thi = 0; thi < nthreads; ++thi)
|
for(long thi = 0; thi < nthreads; ++thi)
|
||||||
QPMS_ENSURE_SUCCESS(pthread_create(thread_ids + thi, NULL,
|
QPMS_ENSURE_SUCCESS(pthread_create(thread_ids + thi, NULL,
|
||||||
|
|
Loading…
Reference in New Issue