Skip to content

Commit

Permalink
cudaErrorNotReady is no longer treated as an error
Browse files Browse the repository at this point in the history
  • Loading branch information
milakov committed May 30, 2013
1 parent 16e2ebc commit 2f7fd14
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions nnforge/cuda/network_updater_cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ namespace nnforge
{
std::vector<testing_result_smart_ptr> res;

entry_count_updated_in_profile_mode = 0;

unsigned int min_dropout_layer_id = testing_layer_count + 1;
for(std::map<unsigned int, float>::const_iterator it = layer_to_dropout_rate_map.begin(); it != layer_to_dropout_rate_map.end(); ++it)
if (it->first < min_dropout_layer_id)
Expand Down Expand Up @@ -250,7 +252,7 @@ namespace nnforge
if (cuda_config->is_flush_required())
{
cuda_safe_call(cudaEventRecord(data_processed_event, *command_stream));
cudaEventQuery(data_processed_event);
cuda_safe_call(cudaEventQuery(data_processed_event));
}
std::tr1::variate_generator<random_generator, std::tr1::uniform_int<unsigned int> > gen_random_offset(
rnd::get_random_generator(),
Expand Down Expand Up @@ -416,20 +418,20 @@ namespace nnforge
if (((input_entry_id % 16) == 1) && cuda_config->is_flush_required())
{
cuda_safe_call(cudaEventRecord(data_processed_event, *command_stream));
cudaEventQuery(data_processed_event);
cuda_safe_call(cudaEventQuery(data_processed_event));
}
} // for(unsigned int input_entry_id

if (profile_mode)
entry_count_updated_in_profile_mode = entries_available_for_processing_count;
entry_count_updated_in_profile_mode += entries_available_for_processing_count;

for(std::vector<testing_result_smart_ptr>::iterator it = res.begin(); it != res.end(); ++it)
(*it)->entry_count += entries_available_for_processing_count;

if (cuda_config->is_flush_required())
{
cuda_safe_call(cudaEventRecord(data_processed_event, *command_stream));
cudaEventQuery(data_processed_event);
cuda_safe_call(cudaEventQuery(data_processed_event));
}
} // if (entries_available_for_processing_count > 0)

Expand Down
2 changes: 1 addition & 1 deletion nnforge/cuda/neural_network_cuda_exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ namespace nnforge
}
}

#define cuda_safe_call(callstr) {cudaError_t error_code = callstr; if (error_code != cudaSuccess) throw nnforge::cuda::neural_network_cuda_exception(error_code);}
#define cuda_safe_call(callstr) {cudaError_t error_code = callstr; if ((error_code != cudaSuccess) && (error_code != cudaErrorNotReady)) throw nnforge::cuda::neural_network_cuda_exception(error_code);}
2 changes: 1 addition & 1 deletion nnforge/neural_network_toolset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ namespace nnforge
std::cout << (boost::format("%|1$.1f| GFLOPs, %|2$.2f| seconds") % gflops % time_to_complete_seconds) << std::endl;
}

std::cout << data[0]->get_stat() << std::endl;
std::cout << data[data.size()-1]->get_stat() << std::endl;
}

void neural_network_toolset::profile_hessian()
Expand Down

0 comments on commit 2f7fd14

Please sign in to comment.