Skip to content

Commit

Permalink
#13 support all available openCL devices
Browse files Browse the repository at this point in the history
#14 check for openCL support on startup, list available platforms/devices
#15 prevent wallet from stuck on solo-mining e.g. on slow blocks/no open gui
#16 writing logfile as optional feature
#17 stop using jocl 0.2.0 as long as there is no performance improvement
#19 provide info about 'incomplete' plot-files
#20 enable selection logLevel DEBUG for users that are interested in more details
  • Loading branch information
de-luxe committed Mar 25, 2016
1 parent 94ceb67 commit 666a105
Show file tree
Hide file tree
Showing 38 changed files with 5,501 additions and 127 deletions.
30 changes: 19 additions & 11 deletions jminer.default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
#
# Requirements:
# - Java8 (64bit recommend to use more memory)
# - openCL 1.2 or 2.0 (use jminer 0.3.6 for openCL 1.1)
# - openCL
#
# PLEASE DONATE
#
# jminer would not be possible without openCL kernels and java code provided by 'burstDev', he really deserves some tips for that!
# jminer would not be possible without openCL kernels and java code provided by 'burstDev',
# he really deserves some tips for that!
# BURST-QHCJ-9HB5-PTGC-5Q8J9
#
# Feel free to support future development of mining engine ...
Expand Down Expand Up @@ -102,10 +103,6 @@ optDevPool=false
# -----------------------------------------------------------------------------------
# - MINING MODE - SOLO ---------------------------------- ONLY NEEDED 4 SOLO MINING -
# -----------------------------------------------------------------------------------
#
# Solo means you send your PASS on commit results!
# DO NOT try to use a online wallet or pool as Server!
#
# soloServer - WARN! soloServer should be http://localhost:8125 or http://127.0.0.1:8125
# (default: Solo means you send your PASS on commit results!
# http://localhost:8125) DO NOT try to use a online wallet or pool as Server!
Expand All @@ -121,11 +118,9 @@ passPhrase=xxxxxxxxxxxxxx
targetDeadline=

# -----------------------------------------------------------------------------------
# - GPU -----------------------------------------------------------------------------
# - OpenCL -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------------
# the miner was tested on AMD and NVIDIA GPUs, feedback about CPU and unsupported GPUs is welcome
#
# the miner uses openCL for most of the mining calculations, ensure it is setup correctly.
# The miner uses openCL for most of the mining calculations, ensure it is setup correctly.
# Instructions can be found e.g. here (thanks cryo):
# https://github.com/bhamon/gpuPlotGenerator/blob/master/README.md
# You could also use that instruction to find your platformId and deviceId if needed.
Expand All @@ -149,12 +144,25 @@ deviceId=
# (default:12000) this timeout is used for all network requests.
# if you use pool or online-wallet, the 12 sec. default may
# cause timeout on committing nonces or getting mining info etc.
#
# debug - setting 'debug' to true will log additional information of the mining process,
# (default:false) that are not related to mining, but to miner internals.
#
# writeLogFile - setting 'writeLogFile' to 'true' will write all logs from console to a file, too.
# (default:false) the name of that file can be specified by 'logFilePath'.
#
# logFilePath - path (filename and optional directory, relative to miner location)
# (default:log/jminer.log.txt)
# -----------------------------------------------------------------------------------
refreshInterval=2000
connectionTimeout=12000

debug=
writeLogFile=
logFilePath=

# -----------------------------------------------------------------------------------
# - MINING ENGINE - APPEARANCE ------------------------------------------------------
# - MINING ENGINE - APPEARANCE / BEHAVIOR -------------------------------------------
# -----------------------------------------------------------------------------------
# readProgressPerRound - defines how often the mining progress is shown per round
# (default:9) thats the 'xx% done ...' info.
Expand Down
6 changes: 3 additions & 3 deletions 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.3-SNAPSHOT</version>
<version>0.4.4-SNAPSHOT</version>
<packaging>jar</packaging>

<name>burstcoin-jminer</name>
Expand All @@ -20,10 +20,10 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>burstcoin.jminer.CommandLineRunner</start-class>
<start-class>burstcoin.jminer.JMinerApplication</start-class>
<java.version>1.8</java.version>
<jetty.version>9.3.8.RC0</jetty.version>
<jocl.version>0.2.0-RC00</jocl.version>
<jocl.version>0.1.9</jocl.version>
<saphir-hash.version>3.0.1</saphir-hash.version>
<bcprov-jdk16.version>1.46</bcprov-jdk16.version>
</properties>
Expand Down
68 changes: 68 additions & 0 deletions src/main/java/burstcoin/jminer/JMinerApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 by luxe - https://github.com/de-luxe - BURST-LUXE-RED2-G6JW-H4HG5
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies
* or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/

package burstcoin.jminer;

import burstcoin.jminer.core.CoreProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.Banner;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;

import java.util.HashMap;
import java.util.Map;

@SpringBootApplication
public class JMinerApplication
{
private static final Logger LOG = LoggerFactory.getLogger(JMinerApplication.class);

public static void main(String[] args)
{
LOG.info("Starting the engines ... please wait!");

// overwritten by application.properties
Map<String, Object> properties = new HashMap<>();
if(CoreProperties.isWriteLogFile())
{
properties.put("logging.file", CoreProperties.getLogFilePath());
}
properties.put("logging.level.burstcoin.jminer.core", CoreProperties.isDebug() ? "DEBUG" : "INFO");

new SpringApplicationBuilder(JMinerApplication.class)
.bannerMode(Banner.Mode.OFF) // turn off spring boot banner
.logStartupInfo(false)
.properties(properties) // add application.properties
.build(args)
.run();
}

@Bean
public CommandLineRunner getCommandLineRunner(ConfigurableApplicationContext context)
{
return new JMinerCommandLine(context);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@
import burstcoin.jminer.core.round.event.RoundStoppedEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ApplicationListener;
import org.springframework.context.ConfigurableApplicationContext;

import java.math.BigDecimal;
import java.math.MathContext;

@SpringBootApplication
public class CommandLineRunner

public class JMinerCommandLine
implements CommandLineRunner
{
private static final Logger LOG = LoggerFactory.getLogger(CommandLineRunner.class);
private static final Logger LOG = LoggerFactory.getLogger(JMinerCommandLine.class);

private static final int NUMBER_OF_PROGRESS_LOGS_PER_ROUND = CoreProperties.getReadProgressPerRound();

Expand All @@ -67,11 +67,37 @@ public class CommandLineRunner
private static long previousRemainingCapacity = 0;
private static long previousElapsedTime = 0;

public static void main(String[] args)
private ConfigurableApplicationContext context;

public JMinerCommandLine(ConfigurableApplicationContext context)
{
this.context = context;
}

@Override
public void run(String... args)
throws Exception
{
LOG.info("start the engines ...");
ConfigurableApplicationContext context = SpringApplication.run(CommandLineRunner.class);
initApplicationListeners();

LOG.info("-------------------------------------------------------");
LOG.info(" Burstcoin (BURST)");
LOG.info(" __ __ GPU assisted PoC-Miner");
LOG.info(" |__| _____ |__| ____ ___________ ");
LOG.info(" version | |/ \\| |/ \\_/ __ \\_ __ \\");
LOG.info(" 0.4.4 | | Y Y \\ | | \\ ___/| | \\/");
LOG.info(" /\\__| |__|_| /__|___| /\\___ >__| ");
LOG.info(" \\______| \\/ \\/ \\/");
LOG.info(" mining engine: BURST-LUXE-RED2-G6JW-H4HG5");
LOG.info(" openCL checker: BURST-QHCJ-9HB5-PTGC-5Q8J9");

Network network = context.getBean(Network.class);
network.checkPoolInfo();
network.startMining();
}

private void initApplicationListeners()
{
context.addApplicationListener(new ApplicationListener<RoundFinishedEvent>()
{
@Override
Expand Down Expand Up @@ -312,24 +338,9 @@ public void onApplicationEvent(NetworkPoolInfoEvent event)
LOG.info(" balance '" + amount + " BURST', total mined '" + totalForget + " BURST'");
}
});

LOG.info("");
LOG.info(" Burstcoin (BURST)");
LOG.info(" __ __ GPU assisted PoC-Miner");
LOG.info(" |__| _____ |__| ____ ___________ ");
LOG.info(" version | |/ \\| |/ \\_/ __ \\_ __ \\");
LOG.info(" 0.4.3 | | Y Y \\ | | \\ ___/| | \\/");
LOG.info(" /\\__| |__|_| /__|___| /\\___ >__| ");
LOG.info(" \\______| \\/ \\/ \\/");
LOG.info(" mining engine: BURST-LUXE-RED2-G6JW-H4HG5");
LOG.info(" openCL checker: BURST-QHCJ-9HB5-PTGC-5Q8J9");

Network network = context.getBean(Network.class);
network.checkPoolInfo();
network.startMining();
}

private static String getDeadlineTime(Long calculatedDeadline)
private String getDeadlineTime(Long calculatedDeadline)
{
long sec = calculatedDeadline;
long min = sec / 60;
Expand Down
34 changes: 34 additions & 0 deletions src/main/java/burstcoin/jminer/core/CoreProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ public class CoreProperties
private static final boolean DEFAULT_LIST_PLOT_FILES = false;
private static final boolean DEFAULT_SHOW_DRIVE_INFO = false;
private static final int DEFAULT_READER_THREADS = 0;
private static final boolean DEFAULT_DEBUG = false;
private static final boolean DEFAULT_WRITE_LOG_FILE = false;
private static final String DEFAULT_LOG_FILE_PATH = "log/jminer.log.txt";

// there seams to be a issue on checker
private static final boolean DEFAULT_OPT_DEV_POOL = false;

Expand Down Expand Up @@ -102,6 +106,9 @@ public class CoreProperties
private static Boolean listPlotFiles;
private static Boolean showDriveInfo;
private static Integer readerThreads;
private static Boolean writeLogFile;
private static Boolean debug;
private static String logFilePath;

private CoreProperties()
{
Expand Down Expand Up @@ -453,6 +460,33 @@ public static boolean isShowDriveInfo()
return showDriveInfo;
}

public static boolean isWriteLogFile()
{
if(writeLogFile == null)
{
writeLogFile = asBoolean("writeLogFile", DEFAULT_WRITE_LOG_FILE);
}
return writeLogFile;
}

public static boolean isDebug()
{
if(debug == null)
{
debug = asBoolean("debug", DEFAULT_DEBUG);
}
return debug;
}

public static String getLogFilePath()
{
if(logFilePath == null)
{
logFilePath = asString("logFilePath", DEFAULT_LOG_FILE_PATH);
}
return logFilePath;
}

private static Boolean asBoolean(String key, boolean defaultValue)
{
String booleanProperty = PROPS.containsKey(key) ? String.valueOf(PROPS.getProperty(key)) : null;
Expand Down
Loading

0 comments on commit 666a105

Please sign in to comment.