Skip to content

Commit

Permalink
Merge pull request #63 from tontechio/develop
Browse files Browse the repository at this point in the history
cuda compute capability 1.1
  • Loading branch information
tontechio authored Nov 16, 2021
2 parents 47c9c46 + 727aba7 commit b44bffb
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ if(MINERCUDA)
enable_language(CUDA)

find_package(CUDA REQUIRED)
SET(CUDA_NVCC_FLAGS “-arch=sm_11”)
include_directories("${CUDA_INCLUDE_DIRS}")

add_library(pow-miner-cuda-lib util/Miner.cpp util/MinerCuda.cpp util/Miner.h util/cuda/miner.h util/cuda/sha256.cpp util/cuda/sha256.h
Expand Down
2 changes: 1 addition & 1 deletion crypto/util/pow-miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ int main(int argc, char* const argv[]) {
break;
case 'F':
factor = atoi(optarg);
CHECK(factor >= 1 && factor <= (1 << MAX_BOOST_POW));
CHECK(factor >= 1 && factor <= 16384);
options.factor = factor;
break;
#endif
Expand Down
1 change: 1 addition & 0 deletions tonlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ if(MINERCUDA)
enable_language(CUDA)

find_package(CUDA REQUIRED)
SET(CUDA_NVCC_FLAGS “-arch=sm_11”)
include_directories("${CUDA_INCLUDE_DIRS}")

add_executable(tonlib-cuda-cli tonlib/tonlib-cli.cpp)
Expand Down
4 changes: 2 additions & 2 deletions tonlib/tonlib/TonlibClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1371,8 +1371,8 @@ void TonlibClient::init_ext_client() {
} else {
auto lite_clients_size = config_.lite_clients.size();
CHECK(lite_clients_size != 0);
auto lite_client_id = td::Random::fast(0, td::narrow_cast<int>(lite_clients_size) - 1);
auto& lite_client = config_.lite_clients[lite_client_id];
lite_client_id_ = td::Random::fast(0, td::narrow_cast<int>(lite_clients_size) - 1);
auto& lite_client = config_.lite_clients[lite_client_id_];
class Callback : public ExtClientLazy::Callback {
public:
explicit Callback(td::actor::ActorShared<> parent) : parent_(std::move(parent)) {
Expand Down
6 changes: 6 additions & 0 deletions tonlib/tonlib/TonlibClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ class TonlibClient : public td::actor::Actor {
}
}

public:
tonlib::Config::LiteClient* get_lite_client() {
return lite_client_id_ >= 0 ? &config_.lite_clients[lite_client_id_] : nullptr;
};

private:
enum class State { Uninited, Running, Closed } state_ = State::Uninited;
td::unique_ptr<TonlibCallback> callback_;
Expand All @@ -98,6 +103,7 @@ class TonlibClient : public td::actor::Actor {
std::string rwallet_init_public_key_;
std::string last_state_key_;
bool use_callbacks_for_network_{false};
int lite_client_id_ = -1;

// KeyStorage
std::shared_ptr<KeyValue> kv_;
Expand Down
7 changes: 5 additions & 2 deletions tonlib/tonlib/tonlib-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ class TonlibCli : public td::actor::Actor {
}

void got_answer(td::optional<std::string> answer) {
need_run_miners_ = true;
source_.cancel();
if (--threads_alive_ == 0) {
threads_.clear();
Expand Down Expand Up @@ -748,8 +749,10 @@ class TonlibCli : public td::actor::Actor {

void with_giver_info(td::Result<tonlib_api::object_ptr<tonlib_api::smc_runResult>> r_info) {
auto status = do_with_giver_info(std::move(r_info));
LOG_IF(ERROR, status.is_error()) << "pminer: " << status;
if (status.is_error()) {
auto lite_client = client_.get_actor_unsafe().get_lite_client();
CHECK(lite_client);
LOG(ERROR) << "pminer: " << status << " (#" << lite_client->address.get_ipv4() << ")";
// need to restart if liteserver is not ready
hangup();
std::exit(3);
Expand Down Expand Up @@ -832,7 +835,7 @@ class TonlibCli : public td::actor::Actor {
auto factor_s = parser.read_word();
if (!factor_s.empty()) {
factor = std::atoi(factor_s.data());
CHECK(factor >= 1 && factor <= (1 << MAX_BOOST_POW));
CHECK(factor >= 1 && factor <= 16384);
}

auto platform_id_s = parser.read_word();
Expand Down

0 comments on commit b44bffb

Please sign in to comment.