Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unknown params crasher #9

Merged
merged 27 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
795815b
Do not crash on unknown params
dirkerdero Mar 21, 2024
b7cdd3f
Silence wget and update env before build
dirkerdero Mar 21, 2024
1280aa9
Try using clang-17
dirkerdero Mar 21, 2024
fd4353c
Use tee instead of redirect
dirkerdero Mar 21, 2024
a3b6491
Get the APT key for LLVM
dirkerdero Mar 21, 2024
025e225
Typo: suto -> sudo
dirkerdero Mar 21, 2024
72f1ddc
Register clang 17
dirkerdero Mar 21, 2024
9d4206e
Merge branch 'dev' of github.com:dirkerdero/tnn-miner into dev
dirkerdero Mar 21, 2024
7e59859
Fix when clang++ is already master
dirkerdero Mar 21, 2024
69c133f
Register clang the easy way
dirkerdero Mar 21, 2024
c6f1b7e
Do it the GitHub way
dirkerdero Mar 21, 2024
409821c
More GitHub way!
dirkerdero Mar 21, 2024
8031849
Update build.yml
dirkerdero Mar 21, 2024
049f526
Dump update-alternatives
dirkerdero Mar 21, 2024
0ed25cb
Update build.yml
dirkerdero Mar 21, 2024
173322c
Update build.yml
dirkerdero Mar 21, 2024
b66e9f8
Fix call to make
dirkerdero Mar 21, 2024
d803773
Archive binary
dirkerdero Mar 21, 2024
fbdfca5
Create a release
dirkerdero Mar 22, 2024
dc93cb7
Only release on Tag
dirkerdero Mar 22, 2024
65bed53
Add on.push.tags
dirkerdero Mar 22, 2024
7d19ee2
Fix tar creation
dirkerdero Mar 22, 2024
a3b61ef
Change devPool address
dirkerdero Mar 23, 2024
80acea9
Fix whitespace
dirkerdero Apr 4, 2024
c50a2b1
Remove unused script
dirkerdero Apr 4, 2024
908ee36
Bump to Clang 18
dirkerdero Apr 4, 2024
5b18ad2
Merge branch 'dev' of github.com:dirkerdero/tnn-miner into dev
dirkerdero Apr 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build Tnn-miner on Ubuntu 22.04

on:
push:
branches:
- '*dev*'
tags:
- "v*.*.*"

jobs:
ubuntu-22:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: 'Update system'
run: |
sudo update-alternatives --display clang
sudo update-alternatives --display clang++
sudo update-alternatives --list clang
sudo update-alternatives --list clang++
sudo update-alternatives --get-selections
sudo apt update && sudo apt upgrade -y
- name: 'Setup pre-reqs'
run: |
sudo apt install git wget build-essential cmake clang libssl-dev libudns-dev libfmt-dev libc++-dev
#sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100 --slave /usr/bin/gcc gcc /usr/bin/gcc-10
- name: 'Install clang 18'
run: |
version=18
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" | sudo tee /etc/apt/sources.list.d/clang.list
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo apt update
sudo apt install -y "clang-$version" "lldb-$version" "lld-$version" "clang-format-$version" "clang-tidy-$version"
- name: 'Update default clang'
run: |
version=18
# https://github.com/actions/runner-images/blob/main/images/ubuntu/scripts/build/install-clang.sh#L17
sudo update-alternatives --display clang++
sudo update-alternatives --display clang
echo "Make Clang ${version} default"
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${version} 100
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${version} 100
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-${version} 100
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-${version} 100
sudo update-alternatives --install /usr/bin/run-clang-tidy run-clang-tidy /usr/bin/run-clang-tidy-${version} 100
sudo update-alternatives --set clang++ /usr/bin/clang++-${version}
sudo update-alternatives --set clang /usr/bin/clang-${version}
sudo update-alternatives --display clang++
sudo update-alternatives --display clang
clang --version
clang++ --version
- name: 'Compile boost'
run: |
wget -q https://github.com/boostorg/boost/releases/download/boost-1.82.0/boost-1.82.0.tar.gz
tar -xf boost-1.82.0.tar.gz
cd boost-1.82.0/
./bootstrap.sh --with-toolset=clang
./b2 clean
./b2 toolset=clang cxxflags=-std=c++20 -stdlib=libc++ linkflags=-stdlib=libc++ link=static
- name: 'Compile Tnn-miner'
run: |
mkdir build
cd build
cmake ..
make -j$(nproc)
tar -zcvf ../tnn-miner.tar.gz Tnn-miner
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
make_latest: "true"
files: |
tnn-miner.tar.gz
- name: Archive tnn-miner.tar.gz
uses: actions/upload-artifact@v4
with:
name: tnn-miner.tar.gz
path: ./tnn-miner.tar.gz
retention-days: 5
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
/cpp_modules
/build
/tests
/boost-1.82.0/**

# Misc
**.txt
Expand Down
31 changes: 22 additions & 9 deletions src/miner/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,15 +435,28 @@ int main(int argc, char **argv)
bool lockThreads = true;
devFee = 2.5;

po::options_description opts = get_prog_opts();
int style = get_prog_style();
po::variables_map vm;
po::store(po::command_line_parser(argc, argv).options(opts).style(style).run(), vm);
po::notify(vm);
po::options_description opts = get_prog_opts();
try {
int style = get_prog_style();
po::store(po::command_line_parser(argc, argv).options(opts).style(style).run(), vm);
po::notify(vm);
}
catch(std::exception& e)
{
std::cerr << "Error: " << e.what() << "\n";
std::cerr << "Remember: Long options now use a double-dash -- instead of a signle-dash -\n";
return -1;
}
catch(...)
{
std::cerr << "Unknown error!" << "\n";
return -1;
}

if (vm.count("help")) {
std::cout << opts << std::endl;
boost::this_thread::sleep_for(boost::chrono::seconds(5));
boost::this_thread::sleep_for(boost::chrono::seconds(1));
return 0;
}
if (vm.count("sabench")) {
Expand Down Expand Up @@ -474,14 +487,14 @@ int main(int argc, char **argv)
printf("ERROR: dev fee must be at least %.2f", minFee);
std::cout << "%" << std::endl;
setcolor(BRIGHT_WHITE);
boost::this_thread::sleep_for(boost::chrono::seconds(5));
boost::this_thread::sleep_for(boost::chrono::seconds(1));
return 1;
}
}
catch (...)
{
printf("ERROR: invalid dev fee parameter... format should be for example '1.0'");
boost::this_thread::sleep_for(boost::chrono::seconds(5));
boost::this_thread::sleep_for(boost::chrono::seconds(1));
return 1;
}
}
Expand Down Expand Up @@ -510,7 +523,7 @@ int main(int argc, char **argv)
printf("Use Lookup\n");
useLookupMine = true;
}

// Ensure we capture *all* of the other options before we start using goto
if (vm.count("test")) {
goto Testing;
Expand Down Expand Up @@ -614,7 +627,7 @@ int main(int argc, char **argv)
TestAstroBWTv3();
// TestAstroBWTv3_cuda();
// TestAstroBWTv3repeattest();
boost::this_thread::sleep_for(boost::chrono::seconds(30));
boost::this_thread::sleep_for(boost::chrono::seconds(3));
return 0;
}
Benchmarking:
Expand Down