fix codedex warnings

This commit is contained in:
lizhenyu 2022-02-25 15:36:45 +08:00
parent 0341d96dd6
commit 2bd2f8cfca
9 changed files with 13 additions and 8 deletions

View File

@ -68,7 +68,7 @@ bool MemSwapManager::Init(const mindspore::session::KernelGraph *kernel_graph) {
bool MemSwapManager::InitSwapThreshold(size_t swap_mem_size) {
distance_threshold_ = execution_order_.size() / kDistanceInitFactor;
distance_decay_step_ = execution_order_.size() / kDistanceInitFactor / tensor_size_num_;
distance_decay_step_ = (execution_order_.size() / kDistanceInitFactor) / tensor_size_num_;
if (distance_decay_step_ <= 1) {
distance_decay_step_ = 1;
}

View File

@ -15,7 +15,6 @@
*/
#include "plugin/device/gpu/hal/device/cuda_driver.h"
#include <iostream>
#include "utils/log_adapter.h"
#include "utils/convert_utils.h"

View File

@ -16,7 +16,6 @@
#include "plugin/device/gpu/hal/device/cuda_env_checker.h"
#include <dirent.h>
#include <cstdlib>
#include <algorithm>
#include "utils/log_adapter.h"

View File

@ -32,6 +32,11 @@ void UpdateStandardDeviation(float stddev, size_t total_count, float *output) {
MS_EXCEPTION_IF_NULL(output);
auto update_stddev_task = [](float stddev, size_t task_len, float *data) {
if (data == nullptr) {
MS_LOG(ERROR) << "The pointer data is nullptr";
return;
}
for (size_t i = 0; i < task_len; i++) {
data[i] *= stddev;
}

View File

@ -77,7 +77,7 @@ class Worker {
bool UpdateEmbeddingTable(const std::vector<Key> &keys, const std::vector<int> &lookup_ids,
const std::vector<float> &vals);
bool running() { return running_; }
bool running() const { return running_; }
void Finalize();
private:

View File

@ -814,6 +814,7 @@ void DataPrepareActor::PrepareHostTensorQueueForControlNode(const std::vector<Te
(*host_tensors)[tensor_position] = input_tensor;
const AnfNodePtr &backend_node = host_data_source_actor_->FetchNode(tensor_position);
MS_EXCEPTION_IF_NULL(input_tensor);
auto tensor_address = std::dynamic_pointer_cast<DeviceTensor>(input_tensor->device_address());
auto device_address = AnfAlgo::GetMutableOutputAddr(backend_node, 0, false);
MS_EXCEPTION_IF_NULL(device_address);

View File

@ -41,7 +41,7 @@ using mindspore::tensor::TensorPtr;
// The output actor is used to receive the output result of actor which represents the graph output.
class OutputActor : public AbstractActor {
public:
OutputActor(std::string name, size_t loop_count, size_t outputs_num)
OutputActor(const std::string &name, size_t loop_count, size_t outputs_num)
: AbstractActor(name, KernelTransformType::kOutputActor, nullptr),
loop_count_(loop_count),
current_count_(0),

View File

@ -464,7 +464,7 @@ void GraphScheduler::Run(ActorSet *const actor_set, const std::vector<DeviceCont
}
void GraphScheduler::SetActorExecutionStrategy(ActorSet *const actor_set, GraphExecutionStrategy strategy,
double execution_time) {
double execution_time) const {
MS_EXCEPTION_IF_NULL(actor_set);
MS_EXCEPTION_IF_NULL(actor_set->loop_count_actor_);
++actor_set->execution_count_;
@ -492,7 +492,7 @@ void GraphScheduler::SetActorExecutionStrategy(ActorSet *const actor_set, GraphE
actor_set->multi_thread_execution_time_ += execution_time;
if (actor_set->execution_count_ == ActorDispatcher::kMultiThreadExecutionCountEnd) {
actor_set->multi_thread_execution_time_ /=
(ActorDispatcher::kMultiThreadExecutionCountEnd - ActorDispatcher::kMultiThreadExecutionCountBegin + 1);
((ActorDispatcher::kMultiThreadExecutionCountEnd - ActorDispatcher::kMultiThreadExecutionCountBegin) + 1);
actor_set->is_multi_thread_execution_ = false;
}
return;

View File

@ -85,7 +85,8 @@ class GraphScheduler {
DISABLE_COPY_AND_ASSIGN(GraphScheduler);
// Set using the multi thread or single thread to execute the actor set by the execution time compared.
void SetActorExecutionStrategy(ActorSet *const actor_set, GraphExecutionStrategy strategy, double execution_time);
void SetActorExecutionStrategy(ActorSet *const actor_set, GraphExecutionStrategy strategy,
double execution_time) const;
// The Global actors contain memory manager actor, recorder actor and debug actor.
void BuildAndScheduleGlobalActor();