Skip to content

Commit

Permalink
new version 0.4.2-RELEASE;
Browse files Browse the repository at this point in the history
some miner bugfixes and cleanup;
changed default for scanPathsEveryRound to true;
  • Loading branch information
de-luxe committed Feb 22, 2016
1 parent 3f64dfb commit 6fbe149
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 30 deletions.
21 changes: 12 additions & 9 deletions jminer.default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# Requirements:
# - Java8 (64bit recommend to use more memory)
# - openCL 1.2 or 2.0
# - openCL 1.2 or 2.0 (use jminer 0.3.6 for openCL 1.1)
#
# PLEASE DONATE
#
Expand All @@ -29,23 +29,26 @@
# -----------------------------------------------------------------------------------
# - PLOT-FILES ----------------------------------------------------------------------
# -----------------------------------------------------------------------------------
# list of plot paths separated with , e.g. D:/,C:/,E:/plots,F:/plots (in one line)
# the miner will treat every path as 'physical' drive and use one thread for it
# plotPaths - list of plot paths separated with , e.g. D:/,C:/,E:/plots,F:/plots (in one line)
# (required) the miner will treat every path as 'physical' drive and use one thread for it
#
# scanPathsEveryRound - optional 'true' will check 'plotPaths' for changed plot files on every round
# (default:true) 'false' will check only on start/restart
#
# listPlotFiles - optional ... list all plotFiles on start, e.g. to use https://bchain.info/BURST/tools/overlap
# (default:false)
# -----------------------------------------------------------------------------------
# (required)
plotPaths=D:/,C:/,E:/plots,F:/plots
# optional (default:false) - 'true' would check 'plotPaths' for changed plot files on every round
scanPathsEveryRound=false
# optional (default:false) - list all plotFiles on start, e.g. to use https://bchain.info/BURST/tools/overlap
listPlotFiles=false
scanPathsEveryRound=
listPlotFiles=

# -----------------------------------------------------------------------------------
# - MINING MODE ---------------------------------------------------------------------
# -----------------------------------------------------------------------------------
# poolMining - 'true' for pool mining, 'false' for solo mining.
# (default:true) ensure to configure the chosen mining-mode below.
# -----------------------------------------------------------------------------------
poolMining=true
poolMining=

# -----------------------------------------------------------------------------------
# - MINING MODE - POOL ---------------------------------- ONLY NEEDED 4 POOL MINING -
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>burstcoin</groupId>
<artifactId>burstcoin-jminer</artifactId>
<version>0.4.2-SNAPSHOT</version>
<version>0.4.2-RELEASE</version>
<packaging>jar</packaging>

<name>burstcoin-jminer</name>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/burstcoin/jminer/CommandLineRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ public void onApplicationEvent(ReaderDriveFinishEvent event)
@Override
public void onApplicationEvent(ReaderDriveInterruptedEvent event)
{
LOG.debug("stopped '" + event.getDirectory() + "' for block '" + event.getBlockNumber() + "'.");
LOG.info("stopped '" + event.getDirectory() + "' for block '" + event.getBlockNumber() + "'.");
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/burstcoin/jminer/core/CoreProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class CoreProperties
private static final int DEFAULT_CONNECTION_TIMEOUT = 6000;
private static final int DEFAULT_WINNER_RETRIES_ON_ASYNC = 4;
private static final int DEFAULT_WINNER_RETRY_INTERVAL_IN_MS = 500;
private static final boolean DEFAULT_SCAN_PATHS_EVERY_ROUND = false;
private static final boolean DEFAULT_SCAN_PATHS_EVERY_ROUND = true;
private static final int DEFAULT_DEV_POOL_COMMITS_PER_ROUND = 3;
private static final boolean DEFAULT_BYTE_UNIT_DECIMAL = true;
private static final boolean DEFAULT_LIST_PLOT_FILES = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
package burstcoin.jminer.core.checker.util;

import burstcoin.jminer.core.CoreProperties;
import org.jocl.CL;
import org.jocl.Pointer;
import org.jocl.Sizeof;
import org.jocl.cl_command_queue;
Expand Down Expand Up @@ -76,7 +75,7 @@ protected void postConstruct()

public void initChecker(int platformId, int deviceId)
{
CL.setExceptionsEnabled(true);
setExceptionsEnabled(true);

int numPlatforms[] = new int[1];
clGetPlatformIDs(0, null, numPlatforms);
Expand Down Expand Up @@ -159,7 +158,7 @@ public void initChecker(int platformId, int deviceId)

public void reset(int platformId, int deviceId)
{
CL.clReleaseContext(context);
clReleaseContext(context);
initChecker(platformId, deviceId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void run()
}
catch(TimeoutException timeoutException)
{
LOG.warn("Unable to solo nonce, caused by connectionTimeout, currently '" + (connectionTimeout/1000) + " sec.' try increasing it!");
LOG.warn("Unable to commit solo nonce, caused by connectionTimeout, currently '" + (connectionTimeout/1000) + " sec.' try increasing it!");
}
catch(Exception e)
{
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/burstcoin/jminer/core/reader/Reader.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,8 @@ public void read(long previousBlockNumber, long blockNumber, int scoopNumber, lo

if(readerPool.getActiveCount() > 0)
{
// todo shutdown still needed?!
// readerPool.shutdown();
long elapsedTime = new Date().getTime() - readerStartTime;
publisher.publishEvent(new ReaderStoppedEvent(previousBlockNumber, capacity, remainingCapacity, elapsedTime, lastBestCommittedDeadline));
// readerPool.initialize();
}

// update reader thread count
Expand Down Expand Up @@ -184,14 +181,18 @@ public Plots getPlots()
return plots;
}

public void freeResources()
public boolean cleanupReaderPool()
{
// if no read thread running, pool will be increased on next round
if(readerPool.getActiveCount() == 0)
{
readerPool.setCorePoolSize(1);
readerPool.setMaxPoolSize(1);
LOG.debug("cleanup was successful ...");
return true;
}
LOG.debug("cleanup skipped ... retry in 1s");
return false;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public void run()
{
long startTime = showDriveInfo ? new Date().getTime() : 0;
Iterator<PlotFile> iterator = plotDrive.getPlotFiles().iterator();
while(iterator.hasNext() && Reader.blockNumber == blockNumber)
boolean interrupted = false;
while(iterator.hasNext() && !interrupted)
{
PlotFile plotPathInfo = iterator.next();
if(plotPathInfo.getStaggeramt() % plotPathInfo.getNumberOfParts() > 0)
Expand All @@ -91,12 +92,12 @@ public void run()
// fallback ... could lead to problems on optimized plot-files
plotPathInfo.setNumberOfParts(1);
}
load(plotPathInfo);
interrupted = load(plotPathInfo);
}

if(showDriveInfo)
{
if(Reader.blockNumber != blockNumber)
if(interrupted)
{
publisher.publishEvent(new ReaderDriveInterruptedEvent(blockNumber, plotDrive.getDirectory()));
}
Expand All @@ -107,7 +108,7 @@ public void run()
}
}

private void load(PlotFile plotFile)
private boolean load(PlotFile plotFile)
{
try (SeekableByteChannel sbc = Files.newByteChannel(plotFile.getFilePath(), EnumSet.of(StandardOpenOption.READ)))
{
Expand All @@ -122,17 +123,17 @@ private void load(PlotFile plotFile)
sbc.position(currentScoopPosition + currentChunkPosition);
for(int partNumber = 0; partNumber < plotFile.getNumberOfParts(); partNumber++)
{
sbc.read(partBuffer);

if(Reader.blockNumber != blockNumber)
{
// todo never reached?!
LOG.debug("loadDriveThread stopped!");
// make sure to stop reading and clean up
chunkNumber += plotFile.getNumberOfChunks();
partNumber += plotFile.getNumberOfParts();
partBuffer.clear();
sbc.close();
return true;
}
else
{
sbc.read(partBuffer);
long chunkPartStartNonce = plotFile.getStartnonce() + (chunkNumber * plotFile.getStaggeramt()) + (partNumber * partSize);
final byte[] scoops = partBuffer.array();
publisher.publishEvent(new ReaderLoadedPartEvent(blockNumber, scoops, chunkPartStartNonce));
Expand All @@ -155,5 +156,6 @@ private void load(PlotFile plotFile)
{
LOG.error("IOException: " + e.getMessage());
}
return false;
}
}
27 changes: 26 additions & 1 deletion src/main/java/burstcoin/jminer/core/round/Round.java
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,35 @@ private void onRoundFinish(long blockNumber)
@Override
public void run()
{
reader.freeResources();
fireEvent(new RoundFinishedEvent(blockNumber, bestCommittedDeadline, elapsedRoundTime));
}
}, 250); // fire deferred

triggerCleanup();
}

private void triggerCleanup()
{
TimerTask cleanupTask = new TimerTask()
{
@Override
public void run()
{
if(!reader.cleanupReaderPool())
{
triggerCleanup();
}
}
};

try
{
timer.schedule(cleanupTask, 1000);
}
catch(IllegalStateException e)
{
LOG.error("cleanup task already scheduled ...");
}
}

private void commitDevPoolNonces(long blockNumber)
Expand Down

0 comments on commit 6fbe149

Please sign in to comment.