mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
Allow to sleep between layer forward in order to reduce load
This commit is contained in:
parent
09f769097a
commit
8690ffdb9b
@ -486,6 +486,8 @@ typedef struct network{
|
|||||||
float *cost;
|
float *cost;
|
||||||
float clip;
|
float clip;
|
||||||
|
|
||||||
|
int sleep_between_layers_forward_us;
|
||||||
|
|
||||||
#ifdef GPU
|
#ifdef GPU
|
||||||
float *input_gpu;
|
float *input_gpu;
|
||||||
float *truth_gpu;
|
float *truth_gpu;
|
||||||
|
@ -206,6 +206,9 @@ void forward_network(network *netp)
|
|||||||
if(l.truth) {
|
if(l.truth) {
|
||||||
net.truth = l.output;
|
net.truth = l.output;
|
||||||
}
|
}
|
||||||
|
if(net.sleep_between_layers_forward_us > 0){
|
||||||
|
usleep(net.sleep_between_layers_forward_us);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
calc_network_cost(netp);
|
calc_network_cost(netp);
|
||||||
}
|
}
|
||||||
@ -788,6 +791,9 @@ void forward_network_gpu(network *netp)
|
|||||||
net.truth_gpu = l.output_gpu;
|
net.truth_gpu = l.output_gpu;
|
||||||
net.truth = l.output;
|
net.truth = l.output;
|
||||||
}
|
}
|
||||||
|
if(net.sleep_between_layers_forward_us > 0){
|
||||||
|
usleep(net.sleep_between_layers_forward_us);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pull_network_output(netp);
|
pull_network_output(netp);
|
||||||
calc_network_cost(netp);
|
calc_network_cost(netp);
|
||||||
@ -832,6 +838,9 @@ void forward_network_gpu_device_input(network *netp)
|
|||||||
if(l.truth) {
|
if(l.truth) {
|
||||||
net.truth_gpu = l.output_gpu;
|
net.truth_gpu = l.output_gpu;
|
||||||
}
|
}
|
||||||
|
if(net.sleep_between_layers_forward_us > 0){
|
||||||
|
usleep(net.sleep_between_layers_forward_us);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pull_network_output(netp);
|
pull_network_output(netp);
|
||||||
calc_network_cost(netp);
|
calc_network_cost(netp);
|
||||||
|
Loading…
Reference in New Issue
Block a user