Skip to content

Commit

Permalink
v2.0.1 - Merge pull request #245 from Chia-Network/develop
Browse files Browse the repository at this point in the history
v2.0.1
  • Loading branch information
haorldbchi authored Nov 7, 2022
2 parents d647918 + c02df73 commit 9fac46a
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 39 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0
2.0.1
5 changes: 5 additions & 0 deletions extract-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ if [[ "$version_str" == "$bb_version_suffix" ]]; then
bb_version_suffix=
fi

# prepend a '-' to the suffix, if necessarry
if [[ -n "$bb_version_suffix" ]] && [[ "${bb_version_suffix:0:1}" != "-" ]]; then
bb_version_suffix="-${bb_version_suffix}"
fi

bb_ver_maj=$(printf $version_str | sed -E -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/' | xargs)
bb_ver_min=$(printf $version_str | sed -E -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\2/' | xargs)
bb_ver_rev=$(printf $version_str | sed -E -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\3/' | xargs)
Expand Down
4 changes: 1 addition & 3 deletions src/plotdisk/DiskPlotter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ DiskPlotter::DiskPlotter( const Config& cfg )
_cx.ioQueue = new DiskBufferQueue( _cx.tmpPath, _cx.tmpPath2, gCfg.outputFolder, _cx.heapBuffer, _cx.heapSize, _cx.ioThreadCount, ioThreadId );
_cx.fencePool = new FencePool( 8 );

// if( cfg.globalCfg->warmStart )
// #TODO: IMPORTANT: Remove this after testing
Log::Line( "WARNING: Forcing warm start for testing." );
if( cfg.globalCfg->warmStart )
{
Log::Line( "Warm start: Pre-faulting memory pages..." );

Expand Down
79 changes: 44 additions & 35 deletions src/plotting/TableWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "threading/MTJob.h"
#include "plotting/CTables.h"

struct TableWriter
namespace TableWriter
{
/// P7
// Table 7's indices into the Table 6's entries.
Expand Down Expand Up @@ -37,43 +37,51 @@ struct TableWriter

static void WriteC3Parks( const uint64 parkCount, uint32* f7Entries, byte* writeBuffer, uint32 jobId = 0 );
static void WriteC3Park( const uint64 length, uint32* f7Entries, byte* parkBuffer, uint32 jobId = 0 );
};

struct P7Job : MTJob<P7Job>
{
uint64 parkCount;
const uint32* indices;
byte* parkBuffer;
/// Jobs
struct P7Job : MTJob<P7Job>
{
uint64 parkCount;
const uint32* indices;
byte* parkBuffer;

void Run() override;
};
void Run() override;
};

template<uint CInterval>
struct C12Job : MTJob<C12Job<CInterval>>
{
uint64 length;
const uint32* f7Entries;
uint32* writeBuffer;
template<uint CInterval>
struct C12Job : MTJob<C12Job<CInterval>>
{
uint64 length;
const uint32* f7Entries;
uint32* writeBuffer;

void Run() override;
};
void Run() override;
};

struct C3Job : MTJob<C3Job>
{
uint64 parkCount;
uint32* f7Entries;
byte* writeBuffer;

void Run() override;
};
struct C3Job : MTJob<C3Job>
{
uint64 parkCount;
uint32* f7Entries;
byte* writeBuffer;

void Run() override;
};
} // End NS


///
/// Implementation
///

namespace TableWriter
{

///
/// P7
///
//-----------------------------------------------------------
template<uint MAX_JOBS>
inline size_t TableWriter::WriteP7( ThreadPool& threadPool, uint32 threadCount, const uint64 length,
inline size_t WriteP7( ThreadPool& threadPool, uint32 threadCount, const uint64 length,
const uint32* indices, byte* parkBuffer )
{
threadCount = std::min( threadCount, MAX_JOBS );
Expand Down Expand Up @@ -137,7 +145,7 @@ inline size_t TableWriter::WriteP7( ThreadPool& threadPool, uint32 threadCount,
}

//-----------------------------------------------------------
inline void TableWriter::WriteP7Parks( const uint64 parkCount, const uint32* indices, byte* parkBuffer, uint32 jobId )
inline void WriteP7Parks( const uint64 parkCount, const uint32* indices, byte* parkBuffer, uint32 jobId )
{
const size_t parkSize = CDiv( (_K + 1) * kEntriesPerPark, 8 );

Expand All @@ -151,7 +159,7 @@ inline void TableWriter::WriteP7Parks( const uint64 parkCount, const uint32* ind

//-----------------------------------------------------------
template<typename TIdx>
inline void TableWriter::WriteP7Entries( const uint64 length, const TIdx* indices, byte* parkBuffer, uint32 jobId )
inline void WriteP7Entries( const uint64 length, const TIdx* indices, byte* parkBuffer, uint32 jobId )
{
ASSERT( length <= kEntriesPerPark );
ASSERT( ((uintptr_t)parkBuffer & 7 ) == 0 );
Expand Down Expand Up @@ -219,7 +227,7 @@ inline void P7Job::Run()
///
//-----------------------------------------------------------
template<uint MAX_JOBS, uint CInterval>
inline size_t TableWriter::WriteC12Parallel(
inline size_t WriteC12Parallel(
ThreadPool& pool, uint32 threadCount, const uint64 length,
const uint32* f7Entries, uint32* parkBuffer )
{
Expand Down Expand Up @@ -280,7 +288,7 @@ inline size_t TableWriter::WriteC12Parallel(

//-----------------------------------------------------------
template<uint CInterval>
inline void TableWriter::WriteC12Entries( const uint64 length, const uint32* f7Entries, uint32* c1Buffer )
inline void WriteC12Entries( const uint64 length, const uint32* f7Entries, uint32* c1Buffer )
{
uint64 f7Src = 0;
for( uint64 i = 0; i < length; i++, f7Src += CInterval )
Expand All @@ -298,7 +306,7 @@ inline void C12Job<CInterval>::Run()
/// C3
///
//-----------------------------------------------------------
inline uint64 TableWriter::GetC3ParkCount( const uint64 length, uint64& outLastParkRemainder )
inline uint64 GetC3ParkCount( const uint64 length, uint64& outLastParkRemainder )
{
const uint64 c3ParkCount = length / kCheckpoint1Interval;
const uint64 lastParkRemainder = length - ( c3ParkCount * kCheckpoint1Interval );
Expand All @@ -316,15 +324,15 @@ inline uint64 TableWriter::GetC3ParkCount( const uint64 length, uint64& outLastP
}

//-----------------------------------------------------------
inline uint64 TableWriter::GetC3ParkCount( const uint64 length )
inline uint64 GetC3ParkCount( const uint64 length )
{
uint64 remainder;
return GetC3ParkCount( length, remainder );
}

//-----------------------------------------------------------
template<uint MAX_JOBS>
inline size_t TableWriter::WriteC3Parallel( ThreadPool& pool, uint32 threadCount, const uint64 length, uint32* f7Entries, byte* c3Buffer )
inline size_t WriteC3Parallel( ThreadPool& pool, uint32 threadCount, const uint64 length, uint32* f7Entries, byte* c3Buffer )
{
threadCount = std::min( threadCount, MAX_JOBS );

Expand Down Expand Up @@ -377,7 +385,7 @@ inline size_t TableWriter::WriteC3Parallel( ThreadPool& pool, uint32 threadCount
}

//-----------------------------------------------------------
inline void TableWriter::WriteC3Parks( const uint64 parkCount, uint32* f7Entries, byte* writeBuffer, uint32 jobId )
inline void WriteC3Parks( const uint64 parkCount, uint32* f7Entries, byte* writeBuffer, uint32 jobId )
{
const size_t c3Size = CalculateC3Size();

Expand All @@ -391,7 +399,7 @@ inline void TableWriter::WriteC3Parks( const uint64 parkCount, uint32* f7Entries
}

//-----------------------------------------------------------
inline void TableWriter::WriteC3Park( const uint64 length, uint32* f7Entries, byte* parkBuffer, uint32 jobId )
inline void WriteC3Park( const uint64 length, uint32* f7Entries, byte* parkBuffer, uint32 jobId )
{
ASSERT( length <= kCheckpoint1Interval-1 );

Expand Down Expand Up @@ -441,3 +449,4 @@ inline void C3Job::Run()
}


} // End nS

0 comments on commit 9fac46a

Please sign in to comment.