31#include "control/common.h"
32#include "control/auxiliary.h"
38int _chameleon_silent = 0;
40__attribute__((unused)) __attribute__((constructor))
static void
43 _chameleon_silent = chameleon_getenv_get_value_int(
"CHAMELEON_SILENT", _chameleon_silent );
47__chameleon_log_debug(
const char *fmt, ... )
51 if ( _chameleon_silent ) {
56 vfprintf( stderr, fmt, ap );
76 CHAM_context_t *chamctxt;
79 if (chamctxt == NULL) {
82 if (chamctxt->warnings_enabled) {
83 fprintf(stderr,
"CHAMELEON WARNING: %s(): %s\n", func_name, msg_text);
103 fprintf( stderr,
"CHAMELEON ERROR: %s(): %s\n", func_name, msg_text );
121 fprintf(stderr,
"CHAMELEON FATAL ERROR: %s(): %s\n", func_name, msg_text);
130 return RUNTIME_thread_rank( chamctxt );
138 CHAM_context_t *chamctxt;
140 if ( chamctxt && chamctxt->autotuning_enabled == CHAMELEON_TRUE ) {
147 return CHAMELEON_SUCCESS;
174 if (! ver_major && ! ver_minor && ! ver_micro)
175 return CHAMELEON_ERR_ILLEGAL_VALUE;
178 *ver_major = CHAMELEON_VERSION_MAJOR;
181 *ver_minor = CHAMELEON_VERSION_MINOR;
184 *ver_micro = CHAMELEON_VERSION_MICRO;
186 return CHAMELEON_SUCCESS;
214 switch( cham_get_flttype(type) ) {
215 case ChamByte:
return (ssize_t)1;
216 case ChamInteger16:
return sizeof(int16_t);
217 case ChamInteger32:
return sizeof(int32_t);
218 case ChamInteger64:
return sizeof(int64_t);
219 case ChamRealHalf:
return (ssize_t)2;
220 case ChamRealFloat:
return sizeof(float);
221 case ChamRealDouble:
return sizeof(double);
222 case ChamComplexHalf:
return (ssize_t)4;
223 case ChamComplexFloat:
return sizeof(float) * 2;
224 case ChamComplexDouble:
return sizeof(double) * 2;
226 return CHAMELEON_ERR_ILLEGAL_VALUE;
236 static int progress = -1;
238 if (maximumValue == 0) {
242 if (currentValue < (INT_MAX / 100) ) {
243 res = div(currentValue*100, maximumValue);
247 res.quot = (int)( ((
double)currentValue * 100.) / (double)maximumValue );
252 if (res.quot > progress) {
253 fprintf(stderr,
"%3d%%\b\b\b\b", res.quot);
257 if (currentValue >= maximumValue) {
267int CHAMELEON_Set_update_progress_callback(
void (*p)(
int,
int)) {
268 update_progress_callback = p;
269 return CHAMELEON_SUCCESS;
int chameleon_tune(cham_tasktype_t func, int M, int N, int NRHS)
void chameleon_error(const char *func_name, const char *msg_text)
void update_progress(int currentValue, int maximumValue)
int chameleon_rank(CHAM_context_t *chamctxt)
void chameleon_warning(const char *func_name, const char *msg_text)
void chameleon_fatal_error(const char *func_name, const char *msg_text)
CHAM_context_t * chameleon_context_self()
ssize_t CHAMELEON_Element_Size(cham_flttype_t type)
int CHAMELEON_Version(int *ver_major, int *ver_minor, int *ver_micro)