Skip to content

Commit

Permalink
Merge pull request #85 from mochimodev/dev
Browse files Browse the repository at this point in the history
v3.0.1: GPU Miner & Network Scan Improvements
  • Loading branch information
chrisdigity authored Feb 10, 2025
2 parents 0a152cc + 9a6d9a5 commit aa108e5
Show file tree
Hide file tree
Showing 16 changed files with 297 additions and 317 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/build-macos-arm64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

name: MacOS arm64
on:
push:
branches: [master, dev]
pull_request:
branches: [master, dev]
workflow_dispatch:
jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Make Mochimo Install
run: make mochimo -C ${{ github.workspace }}
16 changes: 16 additions & 0 deletions .github/workflows/build-ubuntu-arm64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

name: Ubuntu arm64
on:
push:
branches: [master, dev]
pull_request:
branches: [master, dev]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Make Mochimo Install
run: make mochimo -C ${{ github.workspace }}
16 changes: 16 additions & 0 deletions .github/workflows/build-ubuntu-x64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

name: Ubuntu x64
on:
push:
branches: [master, dev]
pull_request:
branches: [master, dev]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Make Mochimo Install
run: make mochimo -C ${{ github.workspace }}
19 changes: 0 additions & 19 deletions .github/workflows/builds.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ defaults:
shell: bash
on:
push:
branches: [main, dev]
branches: [dev, master]
pull_request:
# pull_request branches MUST be a subset of push branches
branches: [main, dev]
branches: [dev, master]
jobs:
audit:
runs-on: ubuntu-latest
Expand Down
52 changes: 42 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,37 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

***

## [3.0.1] - February 10th, 2025

The latest update focuses on improving GPU mining efficiency and network performance. Key improvements include moving (last half) nonce generation to GPU with parallel PRNG implementation, which significantly reduces CPU usage on multi-GPU systems. Network scanning was enhanced with better thread utilization and increased peer sharing capabilities. The update also includes several CUDA-specific improvements, such as error handling, device counting fixes, and migration to static runtime library for the miner. Development workflows were streamlined with individual build targets and updated CI/CD runners. Non-essential features like NVML support and testnet troubleshooting code were removed to improve codebase maintainability.

### Added
- Device launch parameters header for CUDA
- Individual build target workflows in CI/CD
- Links to Wallet and API releases in README
- Manual execution instructions in README

### Changed
- Increased peer sharing capabilities beyond 32 peers
- Improved CPU efficiency of GPU miner
- Moved nonce generation to GPU with parallel PRNG
- Better device handling and status output
- Stabilized hashrate display
- Enhanced network scanning with better thread utilization
- Updated CI/CD runners to latest versions
- Changed CUDA runtime library to static version

### Fixed
- CUDA-specific error handling and checking
- GPU miner (makefile) target dependencies
- Sudo handling in setup script
- CUDA device counting when no GPUs present
- Bridge time check for GPU IDLE->WORK mode

### Removed
- NVML support (wasn't providing useful data)
- Testnet troubleshooting from production code

## [3.0.0] - February 2nd, 2025

Major improvements to Mochimo Addresses including Hash-based Leadger formatting, Base58 error checking perpetual account tags, and UX for account management. Improvements to transactions with the standard transaction capable of 256 destinations, each with their own reference, and easy implementation of additional Digital Signature Algortihms. Improvements to Merkle Root hash allowing for development of Transaction Receipts to validate a transaction was part of the chain without having access to the block data. Improvements to chain linkage and Tfile validation procedures. Improvements to network bandwidth with Variable (sized) Protocol Data Units.
Expand Down Expand Up @@ -234,13 +265,14 @@ October 27th, 2018
- removed default maddr.dat
- removed txq1.lck (process_tx() is now synchronous)

[Unreleased]: https://github.com/adequatesystems/build-c/compare/v3.0.0...HEAD
[3.0.0]: https://github.com/adequatesystems/build-c/compare/v2.4.3...v3.0.0
[2.4.3]: https://github.com/adequatesystems/build-c/compare/v2.4.2...v2.4.3
[2.4.2]: https://github.com/adequatesystems/build-c/compare/v2.4.1...v2.4.2
[2.4.1]: https://github.com/adequatesystems/build-c/compare/v2.4...v2.4.1
[2.4.0]: https://github.com/adequatesystems/build-c/compare/v2.3...v2.4
[2.3.0]: https://github.com/adequatesystems/build-c/compare/v2.2...v2.3
[2.2.0]: https://github.com/adequatesystems/build-c/compare/v2.1...v2.2
[2.1.0]: https://github.com/adequatesystems/build-c/compare/v2.0...v2.1
[2.0.0]: https://github.com/adequatesystems/build-c/releases/tag/v2.0
[Unreleased]: https://github.com/mochimodev/mochimo/compare/v3.0.1...HEAD
[3.0.1]: https://github.com/mochimodev/mochimo/compare/v3.0.0...v3.0.1
[3.0.0]: https://github.com/mochimodev/mochimo/compare/v2.4.3...v3.0.0
[2.4.3]: https://github.com/mochimodev/mochimo/compare/v2.4.2...v2.4.3
[2.4.2]: https://github.com/mochimodev/mochimo/compare/v2.4.1...v2.4.2
[2.4.1]: https://github.com/mochimodev/mochimo/compare/v2.4...v2.4.1
[2.4.0]: https://github.com/mochimodev/mochimo/compare/v2.3...v2.4
[2.3.0]: https://github.com/mochimodev/mochimo/compare/v2.2...v2.3
[2.2.0]: https://github.com/mochimodev/mochimo/compare/v2.1...v2.2
[2.1.0]: https://github.com/mochimodev/mochimo/compare/v2.0...v2.1
[2.0.0]: https://github.com/mochimodev/mochimo/releases/tag/v2.0
28 changes: 8 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![GitHub release (latest by date)](https://img.shields.io/github/release/mochimodev/mochimo.svg?logo=github&logoColor=lightgrey&&labelColor=2d3339&label=&color=%230059ff)](https://github.com/mochimodev/mochimo/releases)
![GitHub commits since latest release (by date)](https://img.shields.io/github/commits-since/mochimodev/mochimo/latest?logo=github&logoColor=lightgrey&labelColor=2d3339&color=%230059ff)<br>
[![Tests workflow](https://github.com/mochimodev/mochimo/actions/workflows/tests.yaml/badge.svg)](https://github.com/mochimodev/mochimo/actions/workflows/tests.yaml)
[![Builds workflow](https://github.com/mochimodev/mochimo/actions/workflows/builds.yaml/badge.svg)](https://github.com/mochimodev/mochimo/actions/workflows/builds.yaml)
[![Approved Build workflow](https://github.com/mochimodev/mochimo/actions/workflows/build-ubuntu-x64.yaml/badge.svg)](https://github.com/mochimodev/mochimo/actions/workflows/build-ubuntu-x64.yaml)
[![CodeQL workflow](https://github.com/mochimodev/mochimo/actions/workflows/codeql.yaml/badge.svg)](https://github.com/mochimodev/mochimo/actions/workflows/codeql.yaml)
***Mochimo Services***
[![Chrome Web Store Version](https://img.shields.io/chrome-web-store/v/fkogefgjocnflhankmffnibdofdiiiho?logo=chromewebstore&label=Chromium%20Wallet&logoColor=lightgrey&labelColor=2d3339)](https://chromewebstore.google.com/detail/mochimo-wallet/fkogefgjocnflhankmffnibdofdiiiho)
Expand All @@ -32,7 +32,12 @@ An API written in Go, intended to comply with the Rosetta Mesh API standard.
<hr><hr>
<h1 align="center"><strong>NODE REQUIREMENTS</strong></h1>

## Minimum Hardware
## Builds on Latest Target Runners
- [![Ubuntu x64 Build](https://github.com/mochimodev/mochimo/actions/workflows/build-ubuntu-x64.yaml/badge.svg)](https://github.com/mochimodev/mochimo/actions/workflows/build-ubuntu-x64.yaml)
- [![Ubuntu arm64 Build](https://github.com/mochimodev/mochimo/actions/workflows/build-ubuntu-arm64.yaml/badge.svg)](https://github.com/mochimodev/mochimo/actions/workflows/build-ubuntu-arm64.yaml)
- [![MacOS arm64 Build](https://github.com/mochimodev/mochimo/actions/workflows/build-macos-arm64.yaml/badge.svg)](https://github.com/mochimodev/mochimo/actions/workflows/build-macos-arm64.yaml)

## System Preconfiguration
- (CPU) Dual-core Processor
- (RAM) 2GB of Random Access Memory
- (SSD) 64GB of Solid State Drive Storage
Expand Down Expand Up @@ -64,25 +69,8 @@ To uninstall a Mochimo Node installed as a service, find your mochimo repositori
[sudo] make uninstall -C ~/.mcm/repo/master
```

## Build Manually
Whatever the reason, build manually with:
```sh
# clone repository, if not already, and change directory
git clone https://github.com/mochimodev/mochimo.git
# (optionally) select a version
git -C mochimo/ checkout v3.0.0
# build mochimo to mochimo/bin/
make -C mochimo/ mochimo
```

## Run Manually

```sh
mochimo/bin/gomochi
```

<hr><hr>
<h1 align="center"><strong>MINER BUILD/USAGE</strong></h1>
<h1 align="center"><strong>MINER INSTRUCTIONS</strong></h1>

## Build GPU Miner
*GPU Miner ONLY supports SOLO mining with NVIDIA cards*<br/>
Expand Down
2 changes: 1 addition & 1 deletion src/bin/gpuminer.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ MCM_DECL_UNUSED
if (get32(bt->bnum) != get32(BT_curr.bnum)) {
total = 0.0;
/* report block summary */
plog("Old work stats; %u(0x%x), diff:%u",
plog("Work summary; block %u(0x%x), difficulty %u",
get32(bt->bnum), get32(bt->bnum), bt->difficulty[0]);
/* print block work stats and hashrate per device */
for (int idx = 0; idx < device_count; idx++) {
Expand Down
2 changes: 1 addition & 1 deletion src/bin/mochimo.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ int init(void)
shuffle32(Rplist, RPLISTLEN);
/* scan network for quorum and highest hash/weight/bnum */
plog("Init network...");
qlen = scan_network(quorum, MAXQUORUM, nethash, netweight, netbnum);
qlen = scan_quorum(quorum, MAXQUORUM, nethash, netweight, netbnum);
plog(" - %d/%d 0x%s 0x...%s", qlen, MAXQUORUM,
bnum2hex(netbnum, bnumhex), weight2hex(netweight, weighthex));
if (qlen == 0) break; /* all alone... */
Expand Down
17 changes: 0 additions & 17 deletions src/ledger.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,23 +709,6 @@ int le_update(const char *ltfname)
}
/* check sort -- MUST BE ascending, NO duplicates */
if (addr_compare(le_prev.addr, le.addr) >= 0) {
/* WTH IS HAPPENING */
perror("le_update() -- addr_compare()");
printf("-----------------------------\n");
printf("lefp: %p\n", (void *) lefp);
printf("ltfp: %p\n", (void *) ltfp);
printf("-----------------------------\n");
print_n_bytes("le_prev.addr ", le_prev.addr, ADDR_LEN);
print_n_bytes("le.addr ", le.addr, ADDR_LEN);
printf("addr_compare(): %d\n", addr_compare(le_prev.addr, le.addr));
printf("condition: %d\n", addr_compare(le_prev.addr, le.addr) >= 0);
printf("-----------------------------\n");
print_n_bytes("lt_prev.addr ", lt_prev.addr, ADDR_LEN);
print_n_bytes("lt.addr ", lt.addr, ADDR_LEN);
printf("addr_compare(): %d\n", addr_compare(lt_prev.addr, lt.addr));
printf("-----------------------------\n");
printf("addr_compare(le, lt): %d\n", addr_compare(le.addr, lt.addr));
/* end WTH IS HAPPENING */
set_errno(EMCM_LESORT);
goto ERROR_CLEANUP;
}
Expand Down
112 changes: 58 additions & 54 deletions src/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,16 @@ int send_balance(NODE *np)
*/
int send_ipl(NODE *np)
{
int count = RPLISTLEN;
word32 count;

if (count > 32) count = 32;
/* count peers in Rplist */
for (count = 0; count < RPLISTLEN; count++) {
if (Rplist[count] == 0) break;
}
/* limit count to space available in buffer size */
if (count > (sizeof(np->tx.buffer) / sizeof(word32))) {
count = (sizeof(np->tx.buffer) / sizeof(word32));
}
/* copy recent peer list to TX */
memcpy(np->tx.buffer, Rplist, sizeof(word32) * count);
put16(np->tx.len, sizeof(word32) * count);
Expand Down Expand Up @@ -901,69 +908,53 @@ bad2: pinklist(np->ip);
* Qualifying Quorum members are placed in quorum[qlen].
* Returns number of qualifying quorum members, or number of
* consensus nodes on the highest chain, if quorum is NULL. */
int scan_network
int scan_quorum
(word32 quorum[], word32 qlen, void *hash, void *weight, void *bnum)
{
TX *tx;
NODE node;
word32 done = 0;
word32 next = 0;
word32 peer;
word32 scanidx = 0;
word32 qcount = 0;
word32 peer, *ipp;
word16 len;
int result;
word8 highhash[HASHLEN] = { 0 };
word8 highweight[32] = { 0 };
word8 highbnum[8] = { 0 };
char weighthex[65], bnumhex[17];
int result;

plog("begin network scan... ");
char ipstr[16];
word16 len;

OMP_PARALLEL_(private(tx, node, peer, ipp, len, result))
{
while (Running && next < RPLISTLEN && Rplist[next]) {
OMP_CRITICAL_()
{
peer = Rplist[next];
if (peer) next++;
}
/* idle condition */
if (peer == 0) {
if (done < next) {
millisleep(100);
continue;
}
break;
}
/* get ip list from peer */
/* iterate through batches of peers */
plog("expand network peers... ");
while (Running && scanidx < Rplistidx) {
if (Rplistidx >= RPLISTLEN) break;
pdebug("scan progress %u/%u...", scanidx, Rplistidx);

/* prepare parallel processing scope, limit threads to 16 */
OMP_PARALLEL_(for num_threads(16) private(node, peer, len, ipstr))
for (word32 idx = scanidx; idx < Rplistidx; idx++) {
if (Rplistidx >= RPLISTLEN) continue;
/* get IP list from peer */
peer = Rplist[idx];
if (get_ipl(&node, peer) == VEOK) {
/* get ip list from TX */
tx = &(node.tx);
len = get16(tx->len);
ipp = (word32 *) tx->buffer;
OMP_CRITICAL_()
{
/* iterate peerlist adding to recent peers */
for( ; len > 0; ipp++, len -= 4) {
if (Rplistidx >= RPLISTLEN) break;
if (*ipp == 0 || pinklisted(*ipp)) continue;
addrecent(*ipp);
}
/* check peer's chain weight against highweight */
result = cmp256(tx->weight, highweight);
if (result >= 0) { /* higher or same chain detection */
if (result > 0) { /* higher chain detection */
result = cmp256(node.tx.weight, highweight);
if (result >= 0) {
/* higher or same chain detected */
if (result > 0) {
/* higher chain detected */
pdebug("new highweight");
memcpy(highhash, tx->cblockhash, HASHLEN);
memcpy(highweight, tx->weight, 32);
put64(highbnum, tx->cblock);
memcpy(highhash, node.tx.cblockhash, HASHLEN);
memcpy(highweight, node.tx.weight, 32);
put64(highbnum, node.tx.cblock);
qcount = 0;
if (quorum) {
memset(quorum, 0, qlen);
pdebug("higher chain found, quourum reset...");
}
} /* check block hash and add to quorum */
if (memcmp(tx->cblockhash, highhash, HASHLEN) >= 0) {
}
/* check block hash and add to quorum */
if (memcmp(node.tx.cblockhash, highhash, HASHLEN) >= 0) {
/* add ip to quorum, or q consensus */
if (quorum && qcount < qlen) {
quorum[qcount++] = peer;
Expand All @@ -972,13 +963,26 @@ int scan_network
}
} /* end if higher or same chain */
} /* end OMP_CRITICAL_() */
} /* end if get_ipl() == VEOK */
/* inspect peer list */
for (len = 0; len < get16(node.tx.len); len += 4) {
peer = *((word32 *) &node.tx.buffer[len]);
if (peer == 0 || pinklisted(peer)) continue;
/* add to recent list */
OMP_CRITICAL_()
if (Rplistidx < RPLISTLEN) {
if (addpeer(peer, Rplist, RPLISTLEN, &Rplistidx)) {
pdebug("Added %s to recent list", ntoa(&peer, ipstr));
}
}
}
} /* end if get_ipl() */
/* atomic increment scan index */
OMP_ATOMIC_()
done++;
} /* end while() */
} /* end OMP_PARALLEL_() */
pdebug("qualifying weight 0x...%s", weight2hex(highweight, weighthex));
pdebug("qualifying block 0x%s", bnum2hex(highbnum, bnumhex));
scanidx++;
} /* end OMP_PARALLEL_() */
} /* end while() */
pdebug("qualifying weight 0x...%s", weight2hex(highweight, NULL));
pdebug("qualifying block 0x%s", bnum2hex(highbnum, NULL));
pdebug("qualifying nodes %d...", qcount);
print_ipl(quorum, qcount);

Expand All @@ -988,7 +992,7 @@ int scan_network
if (bnum) put64(bnum, highbnum);

return qcount;
} /* end scan_network() */
} /* end scan_quorum() */

/* Refresh the ip list and send_found() to low-weight peer if needed.
* Called from server().
Expand Down
Loading

0 comments on commit aa108e5

Please sign in to comment.