Minor fix

This commit is contained in:
AlexeyAB 2020-05-11 03:17:47 +03:00
parent 74134e5389
commit 0c7305cf63
3 changed files with 8 additions and 0 deletions

View File

@ -149,6 +149,8 @@ void train_detector(char *datacfg, char *cfgfile, char *weightfile, int *gpus, i
args.show_imgs = show_imgs;
#ifdef OPENCV
//int num_threads = get_num_threads();
//if(num_threads > 2) args.threads = get_num_threads() - 2;
args.threads = 6 * ngpus; // 3 for - Amazon EC2 Tesla V100: p3.2xlarge (8 logical cores) - p3.16xlarge
//args.threads = 12 * ngpus; // Ryzen 7 2700X (16 logical cores)
mat_cv* img = NULL;

View File

@ -718,6 +718,11 @@ void custom_atomic_store_int(volatile int* obj, int desr)
std::atomic_store(ptr_a, desr);
}
int get_num_threads()
{
return std::thread::hardware_concurrency();
}
#if !defined(__MINGW64__)
void this_thread_sleep_for(int ms_time)
{

View File

@ -26,6 +26,7 @@ int custom_join(custom_thread_t thread, void **value_ptr);
int custom_atomic_load_int(volatile int* obj);
void custom_atomic_store_int(volatile int* obj, int desr);
int get_num_threads();
void this_thread_sleep_for(int ms_time);
void this_thread_yield();