MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / CollectEssentialParallelism

Method CollectEssentialParallelism

tensorflow/core/framework/model.cc:787–808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

785}
786
787std::map<string, std::shared_ptr<Parameter>> Model::CollectEssentialParallelism(
788 std::shared_ptr<Node> node) {
789 // Parallelism parameter is considered to be essential if the coressponding
790 // transformations's processing time is greater than essential rate times the
791 // average transformation self processing time.
792 constexpr double kEssentialRate = 0.3L;
793
794 std::map<string, std::shared_ptr<Parameter>> parameters;
795 node->CollectTunableParameters(&parameters);
796 std::map<string, double> processing_times;
797 double processing_time = node->TotalProcessingTime(&processing_times);
798 double uniform_share =
799 processing_time / static_cast<double>(processing_times.size());
800 std::map<string, std::shared_ptr<Parameter>> essential_parameters;
801 for (auto& pair : parameters) {
802 if (pair.second->name == kParallelism &&
803 processing_times[pair.first] > kEssentialRate * uniform_share) {
804 essential_parameters.insert(pair);
805 }
806 }
807 return essential_parameters;
808}
809
810void Model::OptimizeGradientDescent(int64 cpu_budget, int64 ram_budget) {
811 std::shared_ptr<Node> snapshot;

Callers

nothing calls this directly

Calls 4

TotalProcessingTimeMethod · 0.80
sizeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected