You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
change
#include <c10d/ProcessGroupMPI.hpp>
to
#include <torch/csrc/distributed/c10d/ProcessGroupMPI.hpp>
at line 52
auto pg = c10d::ProcessGroupMPI::createProcessGroupMPI();
return type is c10::intrusive_ptr
and in function waitWork, the type is
void waitWork(std::shared_ptrc10d::ProcessGroupMPI pg, std::vector<std::shared_ptrc10d::ProcessGroupMPI::WorkMPI> works)
so I changed waitWork to
void waitWork(c10::intrusive_ptrc10d::ProcessGroupMPI pg, std::vector<c10::intrusive_ptrc10d::ProcessGroupMPI::WorkMPI> works)
and get 2 error
/opt/libtorch/include/c10/util/intrusive_ptr.h:348:13: error: no matching function for call to 'assign_ptr_'
I can't fix the error.
Steps to Reproduce
cd custom-dataset
mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH=/opt/libtorch ..
make
...
cd distributed
mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH=/opt/libtorch ..
make
Failure Logs [if any]
/Users/anthony/Rnd/gits/pytorch/examples/cpp/custom-dataset/custom-dataset.cpp:90:8: error: no member named 'random_shuffle' in namespace 'std'
std::random_shuffle(train.begin(), train.end());
/Users/anthony/Rnd/gits/pytorch/examples/cpp/custom-dataset/custom-dataset.cpp:91:8: error: no member named 'random_shuffle' in namespace 'std'
std::random_shuffle(test.begin(), test.end());
/Users/anthony/Rnd/gits/pytorch/examples/cpp/custom-dataset/custom-dataset.cpp:122:15: error: no matching constructor for initialization of 'torch::nn::Functional'
push_back(Functional(torch::log_softmax, 1, torch::nullopt));
The text was updated successfully, but these errors were encountered:
AntonyM55
changed the title
compile erros in cpp code
compile errors in cpp code
Aug 8, 2023
Context
Your Environment
Current Behavior
build custom-dataset, get 3 error
build distributed, get 2 error
Possible Solution
project custom-dataset:
error 1 and 2 because std::random_shuffle no longer exists in C++17, so I fixed std::random_shuffle with std::shuffle
e.g.
change
std::random_shuffle(train.begin(), train.end());
std::random_shuffle(test.begin(), test.end());
to
std::random_device rd;
std::mt19937 seed_train(rd());
std::mt19937 seed_test(rd());
std::shuffle(train.begin(), train.end(), seed_train);
std::shuffle(test.begin(), test.end(), seed_test);
I can't fix the 3rd error.
project distributed:
change
#include <c10d/ProcessGroupMPI.hpp>
to
#include <torch/csrc/distributed/c10d/ProcessGroupMPI.hpp>
at line 52
auto pg = c10d::ProcessGroupMPI::createProcessGroupMPI();
return type is c10::intrusive_ptr
and in function waitWork, the type is
void waitWork(std::shared_ptrc10d::ProcessGroupMPI pg, std::vector<std::shared_ptrc10d::ProcessGroupMPI::WorkMPI> works)
so I changed waitWork to
void waitWork(c10::intrusive_ptrc10d::ProcessGroupMPI pg, std::vector<c10::intrusive_ptrc10d::ProcessGroupMPI::WorkMPI> works)
and get 2 error
/opt/libtorch/include/c10/util/intrusive_ptr.h:348:13: error: no matching function for call to 'assign_ptr_'
I can't fix the error.
Steps to Reproduce
cd custom-dataset
mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH=/opt/libtorch ..
make
...
cd distributed
mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH=/opt/libtorch ..
make
Failure Logs [if any]
/Users/anthony/Rnd/gits/pytorch/examples/cpp/custom-dataset/custom-dataset.cpp:90:8: error: no member named 'random_shuffle' in namespace 'std'
std::random_shuffle(train.begin(), train.end());
/Users/anthony/Rnd/gits/pytorch/examples/cpp/custom-dataset/custom-dataset.cpp:91:8: error: no member named 'random_shuffle' in namespace 'std'
std::random_shuffle(test.begin(), test.end());
/Users/anthony/Rnd/gits/pytorch/examples/cpp/custom-dataset/custom-dataset.cpp:122:15: error: no matching constructor for initialization of 'torch::nn::Functional'
push_back(Functional(torch::log_softmax, 1, torch::nullopt));
The text was updated successfully, but these errors were encountered: