Code Monkey home page Code Monkey logo

ethash's Introduction

Build Status Windows Build Status

Ethash

For details on this project, please see the Ethereum wiki: https://github.com/ethereum/wiki/wiki/Ethash

Coding Style for C++ code:

Follow the same exact style as in cpp-ethereum

Coding Style for C code:

The main thing above all is code consistency.

  • Tabs for indentation. A tab is 4 spaces
  • Try to stick to the K&R, especially for the C code.
  • Keep the line lengths reasonable. No hard limit on 80 characters but don't go further than 110. Some people work with multiple buffers next to each other. Make them like you :)

ethash's People

Contributors

chriseth avatar debris avatar ebuchman avatar fjl avatar fselmo avatar gavofyork avatar jaekwon avatar karalabe avatar lefterisjp avatar obscuren avatar reorder avatar sammy007 avatar sontol avatar subtly avatar tiimjiim avatar vbuterin avatar wanderer avatar xcthulhu avatar zelig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ethash's Issues

munmap not delete the right address range

we use mmap map the whole file, and ret->data is only part of the file without ETHASH_DAG_MAGIC_NUM

static bool ethash_mmap(struct ethash_full* ret, FILE* f)
{
	int fd;
	char* mmapped_data;
	errno = 0;
	ret->file = f;
	if ((fd = ethash_fileno(ret->file)) == -1) {
		return false;
	}
	mmapped_data= mmap(
		NULL,
		(size_t)ret->file_size + ETHASH_DAG_MAGIC_NUM_SIZE,
		PROT_READ | PROT_WRITE,
		MAP_SHARED,
		fd,
		0
	);
	if (mmapped_data == MAP_FAILED) {
		return false;
	}
	ret->data = (node*)(mmapped_data + ETHASH_DAG_MAGIC_NUM_SIZE);
	return true;
}

finally we munmap the address only begin with ret->data, then munmap(..) != 0

munmap(full->data, (size_t)full->file_size);

Does not build on mac

NDUSERCA312:ethash alexn$ make
./test/test.sh

########### Testing JS

Ethash startup took: 204ms
Ethash cache hash: 3e660a3d5e20b957171a697b5a4035bdfbf6d18168dd1438dc6fec12c37e1ecb
Light client hashes averaged: 20ms
Hash = 9e737d37884a1be1862c4b80e97374ba3e75555e1cc2840b20708541c7bdbeb3

########### Testing C

Scanning dependencies of target ethash
[ 20%] Building C object src/libethash/CMakeFiles/ethash.dir/io.c.o
[ 40%] Building C object src/libethash/CMakeFiles/ethash.dir/internal.c.o
In file included from /Users/alexn/projects/ethash/src/libethash/internal.c:38:
/Users/alexn/projects/ethash/src/libethash/sha3_cryptopp.h:12:28: warning: redefinition of typedef 'ethash_h256_t' is a C11 feature [-Wtypedef-redefinition]
typedef struct ethash_h256 ethash_h256_t;
^
/Users/alexn/projects/ethash/src/libethash/ethash.h:54:47: note: previous definition is here
typedef struct ethash_h256 { uint8_t b[32]; } ethash_h256_t;
^
1 warning generated.
[ 60%] Building C object src/libethash/CMakeFiles/ethash.dir/io_posix.c.o
[ 80%] Building CXX object src/libethash/CMakeFiles/ethash.dir/sha3_cryptopp.cpp.o
Linking CXX static library libethash.a
[ 80%] Built target ethash
Scanning dependencies of target Test
[100%] Building CXX object test/c/CMakeFiles/Test.dir/test.cpp.o
Linking CXX executable Test
Undefined symbols for architecture x86_64:
"boost::unit_test::unit_test_main(bool (_)(), int, char__)", referenced from:
main in test.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[4]: *
* [test/c/Test] Error 1
make[3]: *** [test/c/CMakeFiles/Test.dir/all] Error 2
make[2]: *** [test/c/CMakeFiles/Test.dir/rule] Error 2
make[1]: *** [Test] Error 2
make: *** [test] Error 2
NDUSERCA312:ethash alexn$

not able to collect dag

import pyethash

with open("cache","rb") as fcache:
cache = fcache.read()

Using same block 0 from benchmark code

data_size = pyethash.get_full_size(0)

print("Generating dataset (DAG) of size %d." % data_size)
dataset = pyethash.calc_dataset_bytes(data_size, cache)

with open("dataset","w+b") as fcache:
fcache.write(dataset)

getting below error:
AttributeError: 'module' object has no attribute 'get_full_size'

can't find ethash_params in benchmarl.cpp

Good day to everybody,
i'm new here and would like to test make Benchmark_FULL
, but i'm told that ‘ethash_params’ was not declared:

deeplearning@deep-learning-virtual-machine:~/ethash/test/c/build$ make Benchmark_FULL
[ 71%] Built target ethash
Scanning dependencies of target Benchmark_FULL
[ 85%] Building CXX object src/benchmark/CMakeFiles/Benchmark_FULL.dir/benchmark.cpp.o
/home/deeplearning/ethash/src/benchmark/benchmark.cpp: In function ‘int main()’:
/home/deeplearning/ethash/src/benchmark/benchmark.cpp:108:2: error: ‘ethash_params’ was not declared in this scope
ethash_params params;
^
/home/deeplearning/ethash/src/benchmark/benchmark.cpp:109:22: error: ‘params’ was not declared in this scope
ethash_params_init(&params, 0);
^
/home/deeplearning/ethash/src/benchmark/benchmark.cpp:109:31: error: ‘ethash_params_init’ was not declared in this scope
ethash_params_init(&params, 0);
^
/home/deeplearning/ethash/src/benchmark/benchmark.cpp:129:2: error: ‘ethash_cache’ was not declared in this scope
ethash_cache cache;
^
/home/deeplearning/ethash/src/benchmark/benchmark.cpp:130:2: error: ‘cache’ was not declared in this scope
cache.mem = cache_mem;
^
/home/deeplearning/ethash/src/benchmark/benchmark.cpp:135:40: error: ‘ethash_mkcache’ was not declared in this scope
ethash_mkcache(&cache, &params, &seed);
^
/home/deeplearning/ethash/src/benchmark/benchmark.cpp:146:58: error: invalid use of incomplete type ‘struct ethash_light’
ethash_light(&hash, &cache, &params, &previous_hash, 0);
^
In file included from /home/deeplearning/ethash/src/benchmark/benchmark.cpp:25:0:
/home/deeplearning/ethash/src/benchmark/../libethash/ethash.h:58:8: note: forward declaration of ‘struct ethash_light’
struct ethash_light;
^
/home/deeplearning/ethash/src/benchmark/benchmark.cpp:153:54: error: ‘ethash_compute_full_data’ was not declared in this scope
ethash_compute_full_data(full_mem, &params, &cache);
^
/home/deeplearning/ethash/src/benchmark/benchmark.cpp:175:58: error: invalid use of incomplete type ‘struct ethash_full’
ethash_full(&hash, full_mem, &params, &previous_hash, 0);
^
In file included from /home/deeplearning/ethash/src/benchmark/benchmark.cpp:25:0:
/home/deeplearning/ethash/src/benchmark/../libethash/ethash.h:60:8: note: forward declaration of ‘struct ethash_full’
struct ethash_full;
^
/home/deeplearning/ethash/src/benchmark/benchmark.cpp:248:64: error: invalid use of incomplete type ‘struct ethash_full’
ethash_full(&hash, full_mem, &params, &previous_hash, nonce);
^
In file included from /home/deeplearning/ethash/src/benchmark/benchmark.cpp:25:0:
/home/deeplearning/ethash/src/benchmark/../libethash/ethash.h:60:8: note: forward declaration of ‘struct ethash_full’
struct ethash_full;
^
src/benchmark/CMakeFiles/Benchmark_FULL.dir/build.make:62: recipe for target 'src/benchmark/CMakeFiles/Benchmark_FULL.dir/benchmark.cpp.o' failed
make[3]: *** [src/benchmark/CMakeFiles/Benchmark_FULL.dir/benchmark.cpp.o] Error 1
CMakeFiles/Makefile2:210: recipe for target 'src/benchmark/CMakeFiles/Benchmark_FULL.dir/all' failed
make[2]: *** [src/benchmark/CMakeFiles/Benchmark_FULL.dir/all] Error 2
CMakeFiles/Makefile2:217: recipe for target 'src/benchmark/CMakeFiles/Benchmark_FULL.dir/rule' failed
make[1]: *** [src/benchmark/CMakeFiles/Benchmark_FULL.dir/rule] Error 2
Makefile:157: recipe for target 'Benchmark_FULL' failed
make: *** [Benchmark_FULL] Error 2

Could you please advise ethash_params in benchmarl.cpp or give the working version of this file ?

thanks a lot

Windows Ethash directory is not consistent with the C++ backend

If I start miner in the geth, Ethash directory is C:\Users\User\AppData\Ethash
But it should be (and is in the ethminer) C:\Users\User\AppData\Local\Ethash
Proper way to get this location in Windows is %LOCALAPPDATA%
So I would say it should look like

    if runtime.GOOS == "windows" {
        return filepath.Join(os.Getenv("LOCALAPPDATA"), "Ethash")
    }

Hash Rate Error in ethash_opencl.go

Based on the ethminer-cpp code, Line 506 is not quite right. Rather than (loops * 1000 * 256), it should be (loops * globalWorkSize). Note that globalWorkSize is the product of the --cl-global-work MULTIPLIER and --cl-local-work command line options to ethminer-cpp. The respective defaults are 4096 and 64, so the default value of m_globalWorkSize (in "ethminer") is 262144. The current GO code is close :) for the default values, but does not take into account that they are changeable at runtime (although I didn't look to see if that's the case in the GO implementation). For the cpp reference code see:
libethash-cl/ethash-cl-miner.cpp line 547 hook.searched(), which is defined in:
libethcore/EthashGPUMiner.cpp line 82 virtual bool searched()

HTH

-David

Add LICENSE

There is no LICENSE in this repo. This basically makes it illegal to be used by anyone as a dependency, including all users of geth.

Strange loop

for (uint32_t w = 0; w != MIX_WORDS; ++w) {

How come the loop is for (uint32_t w = 0; w != MIX_WORDS; ++w)??
The #define for MIX_WORDS is 32. whereas the union node accessed via word is a max of 16.
Am i not looking at this right or is it actually a bug?

go test ./... fails

When I try to run tests, I get the following failure

$ go test ./...
?       github.com/ethereum/ethash  [no test files]
2015/03/16 11:30:22 Block Number:  5
2015/03/16 11:30:22 difficulty 10000
--- FAIL: TestEthash (1.75s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x4175c72]

goroutine 6 [running]:
testing.func·006()
    /usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:441 +0x181
github.com/ethereum/ethash.(*Ethash).UpdateDAG(0xc208030460)
    /Users/mpwd/.go/src/github.com/ethereum/ethash/ethash.go:172 +0x5b2
github.com/ethereum/ethash.(*Ethash).FullHash(0xc208030460, 0x0, 0xc2080bf120, 0x20, 0x20, 0x0, 0x0, 0x0)
    /Users/mpwd/.go/src/github.com/ethereum/ethash/ethash.go:388 +0x4c
github.com/ethereum/ethash/test/go.TestEthash(0xc20807e090)
    /Users/mpwd/.go/src/github.com/ethereum/ethash/test/go/ethash_test.go:46 +0x5cd
testing.tRunner(0xc20807e090, 0x46db620)
    /usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:447 +0xbf
created by testing.RunTests
    /usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:555 +0xa8b

goroutine 1 [chan receive]:
testing.RunTests(0x45c3050, 0x46db620, 0x2, 0x2, 0xc20809e401)
    /usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:556 +0xad6
testing.(*M).Run(0xc208030ff0, 0x4705fa0)
    /usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:485 +0x6c
main.main()
    github.com/ethereum/ethash/test/go/_test/_testmain.go:54 +0x1d5

goroutine 5 [select]:
github.com/ethereum/go-ethereum/logger.dispatchLoop()
    /Users/mpwd/.go/src/github.com/ethereum/go-ethereum/logger/sys.go:41 +0x6d0
created by github.com/ethereum/go-ethereum/logger.init·1
    /Users/mpwd/.go/src/github.com/ethereum/go-ethereum/logger/sys.go:20 +0x25

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /usr/local/Cellar/go/1.4.2/libexec/src/runtime/asm_amd64.s:2232 +0x1
FAIL    github.com/ethereum/ethash/test/go  1.933s

Stale DAG generated causing immediate regeneration

Using geth (develop commit fc1d1f9), the newly generated DAG is flagged as stale right after it being completed; causing another regeneration to be triggered. I would expect that no staleness to happen and only 1 DAG generation to be sufficient.

Full logs:

Welcome to the FRONTIER
I0410 13:09:17.378095   11187 backend.go:180] Protocol Version: 60, Network Id: 0
I0410 13:09:17.379846   11187 chain_manager.go:186] Last block (#57346) 8be45fc7206a5afdefa8b3839bfeb0515827d6ac6769ef0611bb3eddec098fc7 TD=72784439970
I0410 13:09:17.718830   11187 ethash.go:94] Making cache
I0410 13:09:18.654124   11187 ethash.go:99] Took: 935.244142ms
I0410 13:09:18.659580   11187 cmd.go:116] Starting  Geth/v0.9.8/darwin/go1.4.2
I0410 13:09:18.659766   11187 server.go:164] Starting Server
I0410 13:09:19.280743   11187 nat.go:94] mapping error: no devices discovered
I0410 13:09:19.281099   11187 udp.go:157] Listening, enode://643e4d8208a852bed13dcead607c61f5491d16e42c9a4bdf7ab8c1d1768b894e694cc4b1a78ec34c39537338218b201f7f5e4cb09c7fd69bb0b19e76b6bc9c7c@[::]:30303
I0410 13:09:19.281349   11187 nat.go:94] mapping error: no devices discovered
I0410 13:09:19.281335   11187 server.go:266] Listening on [::]:30303
I0410 13:09:19.281569   11187 blockpool.go:265] Blockpool started
I0410 13:09:19.281658   11187 whisper.go:72] Whisper started
I0410 13:09:19.281730   11187 backend.go:383] Server started
I0410 13:09:20.301319   11187 ethash.go:94] Making cache
I0410 13:09:21.403573   11187 ethash.go:99] Took: 1.102227801s
I0410 13:09:21.403607   11187 ethash.go:198] Retrieving DAG
I0410 13:09:21.403641   11187 ethash.go:203] No DAG found. Generating new DAG in '/tmp/dag' (this takes a while)...
I0410 13:09:26.406739   11187 ethash.go:136] ... still generating DAG (5.003045356) ...
I0410 13:09:31.404477   11187 ethash.go:136] ... still generating DAG (10.000782487) ...
I0410 13:09:36.407034   11187 ethash.go:136] ... still generating DAG (15.003339022) ...
I0410 13:09:38.505930   11187 chain_manager.go:544] imported 170 block(s) 0 queued in 1.489448954s. #57515 [ba10a4cb / 0ffd8ead]
I0410 13:09:41.284214   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 2.77800654s. #57771 [3dadda69 / 4558c413]
I0410 13:09:41.405356   11187 ethash.go:136] ... still generating DAG (20.001661597) ...
I0410 13:09:42.295437   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 1.010993289s. #58027 [4afb184d / eeb3997b]
I0410 13:09:43.193584   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 897.864808ms. #58283 [b12358cf / 3b69f298]
I0410 13:09:44.213937   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 1.020095712s. #58539 [761b993b / ca4f961f]
I0410 13:09:45.085637   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 871.381531ms. #58795 [95258905 / da7ed1b8]
I0410 13:09:45.975898   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 889.994726ms. #59051 [a146b188 / 64ae1b0c]
I0410 13:09:46.406604   11187 ethash.go:136] ... still generating DAG (25.002910636) ...
I0410 13:09:46.867102   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 890.929919ms. #59307 [424739fb / 591c3935]
I0410 13:09:47.754477   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 887.047754ms. #59563 [138f7f9c / 619e3691]
I0410 13:09:48.663106   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 908.402605ms. #59819 [c9511426 / 79cf1abd]
I0410 13:09:49.335985   11187 ethash.go:94] Making cache
I0410 13:09:50.233732   11187 ethash.go:99] Took: 897.71736ms
I0410 13:09:50.514776   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 1.851433292s. #60075 [379b8f14 / 8bccff58]
I0410 13:09:51.404847   11187 ethash.go:136] ... still generating DAG (30.001155713) ...
I0410 13:09:51.516661   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 1.001635161s. #60331 [3f4106e1 / 35d2021d]
I0410 13:09:52.480543   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 963.619331ms. #60587 [31937c34 / b1ac9278]
I0410 13:09:53.467257   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 986.466838ms. #60843 [4ca29ed4 / 8258abe6]
I0410 13:09:54.440704   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 973.16776ms. #61099 [1c838b73 / 1870333f]
I0410 13:09:55.435017   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 993.950945ms. #61355 [d8f4a17d / 9b500914]
I0410 13:09:56.396171   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 960.89642ms. #61611 [15186ad4 / d8be7e11]
I0410 13:09:56.403866   11187 ethash.go:136] ... still generating DAG (35.000176577) ...
I0410 13:09:58.132360   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 1.73594385s. #61867 [ab71224c / 9fe35f37]
I0410 13:09:59.120999   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 988.266869ms. #62123 [46ff4b6e / c5e9dc72]
I0410 13:10:00.297502   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 1.17620363s. #62379 [9c1b1a63 / c8dc72ea]
I0410 13:10:01.262857   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 965.129722ms. #62635 [cd6089a3 / e6ef26ad]
I0410 13:10:01.406693   11187 ethash.go:136] ... still generating DAG (40.003000427) ...
I0410 13:10:02.242660   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 979.558969ms. #62891 [c4034ab2 / 16bd585a]
I0410 13:10:03.224733   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 981.852151ms. #63147 [2d5cf3de / 7e776da9]
I0410 13:10:04.214865   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 989.850865ms. #63403 [b16da481 / 29600bcb]
I0410 13:10:05.207679   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 992.559133ms. #63659 [541a3a1a / 9acc6762]
I0410 13:10:06.219982   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 1.01199924s. #63915 [bb858ab3 / 91475a87]
I0410 13:10:06.405234   11187 ethash.go:136] ... still generating DAG (45.001543377) ...
I0410 13:10:07.216912   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 996.682815ms. #64171 [f9b95064 / 78af7b9f]
I0410 13:10:08.947587   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 1.730348989s. #64427 [0fcd6a92 / b90f4e74]
I0410 13:10:10.930265   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 1.982460776s. #64683 [5b61c5bc / 8fdd0d9a]
I0410 13:10:11.403746   11187 ethash.go:136] ... still generating DAG (50.000054344) ...
I0410 13:10:11.957999   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 1.027521736s. #64939 [2dcfa535 / ff6ac911]
I0410 13:10:13.034314   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 1.076016904s. #65195 [714ac215 / 1030869f]
I0410 13:10:15.192237   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 2.157653337s. #65451 [26cbe1ac / 3a3c30e5]
I0410 13:10:16.404222   11187 ethash.go:136] ... still generating DAG (55.000529041) ...
I0410 13:10:17.064352   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 1.871860958s. #65707 [0752ad5d / 40c88976]
I0410 13:10:19.548593   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 2.483955139s. #65963 [5f02ae84 / 4b8514c0]
I0410 13:10:21.407355   11187 ethash.go:136] ... still generating DAG (60.003659764) ...
I0410 13:10:21.665823   11187 chain_manager.go:544] imported 256 block(s) 0 queued in 2.116877024s. #66219 [83a64b77 / 686ada38]
I0410 13:10:23.337991   11187 chain_manager.go:544] imported 257 block(s) 0 queued in 1.671835973s. #66476 [c4e8c6b2 / 42a4cc55]
I0410 13:10:23.338259   11187 chain_manager.go:480] INVALID block #66481 (fd6aa509)
I0410 13:10:23.338277   11187 chain_manager.go:481] Block's parent unknown 6e2b6e80883dec7c9115c76f7bf79c1fd138cdb21e4fc914f7c3fb3fbdcc291b
I0410 13:10:23.338292   11187 errors.go:82] [Blockpool] Invalid block: [Block's parent unknown 6e2b6e80883dec7c9115c76f7bf79c1fd138cdb21e4fc914f7c3fb3fbdcc291b]
2015/04/10 13:10:23 [Blockpool] invalid block 0e0a2c1435de9d1412c52adbe7a04421d6be94875224562b235a31f0ab13f64d
2015/04/10 13:10:23 [Blockpool] penalise peers 487611428e6c99a1 (hash), 487611428e6c99a1 (block)
I0410 13:10:26.403887   11187 ethash.go:136] ... still generating DAG (65.000193849) ...
I0410 13:10:31.406374   11187 ethash.go:136] ... still generating DAG (70.002680102) ...
I0410 13:10:36.405621   11187 ethash.go:136] ... still generating DAG (75.001928214) ...
I0410 13:10:41.404619   11187 ethash.go:136] ... still generating DAG (80.000926101) ...
I0410 13:10:46.406856   11187 ethash.go:136] ... still generating DAG (85.003161586) ...
I0410 13:10:46.742707   11187 chain_manager.go:544] imported 8 block(s) 0 queued in 159.762252ms. #66484 [c5fb40fc / 63aa99a0]
I0410 13:10:51.406064   11187 ethash.go:136] ... still generating DAG (90.002370069) ...
I0410 13:10:56.404695   11187 ethash.go:136] ... still generating DAG (95.000999267) ...
I0410 13:11:01.405593   11187 ethash.go:136] ... still generating DAG (100.001889499) ...
I0410 13:11:06.404483   11187 ethash.go:136] ... still generating DAG (105.000788781) ...
I0410 13:11:11.405020   11187 ethash.go:136] ... still generating DAG (110.001326854) ...
I0410 13:11:16.407163   11187 ethash.go:136] ... still generating DAG (115.003466484) ...
I0410 13:11:21.407098   11187 ethash.go:136] ... still generating DAG (120.003404059) ...
I0410 13:11:26.405073   11187 ethash.go:136] ... still generating DAG (125.001378886) ...
I0410 13:11:31.403765   11187 ethash.go:136] ... still generating DAG (130.000064002) ...
I0410 13:11:36.405563   11187 ethash.go:136] ... still generating DAG (135.001869248) ...
I0410 13:11:41.405060   11187 ethash.go:136] ... still generating DAG (140.001363434) ...
I0410 13:11:46.405077   11187 ethash.go:136] ... still generating DAG (145.001383489) ...
I0410 13:11:51.405639   11187 ethash.go:136] ... still generating DAG (150.001944266) ...
I0410 13:11:56.404138   11187 ethash.go:136] ... still generating DAG (155.000443499) ...
I0410 13:12:01.404584   11187 ethash.go:136] ... still generating DAG (160.000890683) ...
I0410 13:12:06.406231   11187 ethash.go:136] ... still generating DAG (165.00253699) ...
I0410 13:12:11.404211   11187 ethash.go:136] ... still generating DAG (170.000517108) ...
I0410 13:12:16.404577   11187 ethash.go:136] ... still generating DAG (175.000884651) ...
I0410 13:12:21.404878   11187 ethash.go:136] ... still generating DAG (180.001183905) ...
I0410 13:12:26.403760   11187 ethash.go:136] ... still generating DAG (185.00006847) ...
I0410 13:12:31.404805   11187 ethash.go:136] ... still generating DAG (190.001112138) ...
I0410 13:12:36.403998   11187 ethash.go:136] ... still generating DAG (195.000300959) ...
I0410 13:12:41.404801   11187 ethash.go:136] ... still generating DAG (200.001107936) ...
I0410 13:12:46.403781   11187 ethash.go:136] ... still generating DAG (205.000086963) ...
I0410 13:12:51.404405   11187 ethash.go:136] ... still generating DAG (210.000711869) ...
I0410 13:12:56.403774   11187 ethash.go:136] ... still generating DAG (215.000081669) ...
I0410 13:13:01.403986   11187 ethash.go:136] ... still generating DAG (220.000292721) ...
I0410 13:13:06.404488   11187 ethash.go:136] ... still generating DAG (225.000792413) ...
I0410 13:13:11.404725   11187 ethash.go:136] ... still generating DAG (230.001032121) ...
I0410 13:13:16.404162   11187 ethash.go:136] ... still generating DAG (235.000469203) ...
I0410 13:13:21.404561   11187 ethash.go:136] ... still generating DAG (240.000868305) ...
I0410 13:13:26.404033   11187 ethash.go:136] ... still generating DAG (245.00033528) ...
I0410 13:13:31.404097   11187 ethash.go:136] ... still generating DAG (250.000404628) ...
I0410 13:13:36.403783   11187 ethash.go:136] ... still generating DAG (255.000087036) ...
I0410 13:13:41.404471   11187 ethash.go:136] ... still generating DAG (260.000776728) ...
I0410 13:13:46.404186   11187 ethash.go:136] ... still generating DAG (265.000493537) ...
I0410 13:13:51.404535   11187 ethash.go:136] ... still generating DAG (270.000839551) ...
I0410 13:13:56.404003   11187 ethash.go:136] ... still generating DAG (275.000307039) ...
I0410 13:14:01.404490   11187 ethash.go:136] ... still generating DAG (280.000795644) ...
I0410 13:14:06.404230   11187 ethash.go:136] ... still generating DAG (285.000536063) ...
I0410 13:14:11.403895   11187 ethash.go:136] ... still generating DAG (290.000193935) ...
I0410 13:14:16.404815   11187 ethash.go:136] ... still generating DAG (295.001120182) ...
I0410 13:14:21.404579   11187 ethash.go:136] ... still generating DAG (300.000881449) ...
I0410 13:14:26.404006   11187 ethash.go:136] ... still generating DAG (305.000311946) ...
I0410 13:14:31.404797   11187 ethash.go:136] ... still generating DAG (310.001103908) ...
I0410 13:14:36.404375   11187 ethash.go:136] ... still generating DAG (315.000682531) ...
I0410 13:14:41.404763   11187 ethash.go:136] ... still generating DAG (320.001068339) ...
I0410 13:14:46.404198   11187 ethash.go:136] ... still generating DAG (325.000504508) ...
I0410 13:14:51.404204   11187 ethash.go:136] ... still generating DAG (330.000511482) ...
I0410 13:14:56.404083   11187 ethash.go:136] ... still generating DAG (335.000387582) ...
I0410 13:15:01.403803   11187 ethash.go:136] ... still generating DAG (340.000109373) ...
I0410 13:15:06.404187   11187 ethash.go:136] ... still generating DAG (345.000494401) ...
I0410 13:15:11.404749   11187 ethash.go:136] ... still generating DAG (350.001054251) ...
I0410 13:15:16.404647   11187 ethash.go:136] ... still generating DAG (355.000952182) ...
I0410 13:15:21.404450   11187 ethash.go:136] ... still generating DAG (360.000757082) ...
I0410 13:15:26.404732   11187 ethash.go:136] ... still generating DAG (365.001038369) ...
I0410 13:15:31.404417   11187 ethash.go:136] ... still generating DAG (370.00072256) ...
I0410 13:15:36.394374   11187 ethash.go:138] ... DAG generation completed ...
I0410 13:15:39.695902   11187 ethash.go:243] Took: 6m18.292281148s
I0410 13:15:39.715202   11187 worker.go:314] commit new work on block 66485 with 0 txs & 0 uncles
I0410 13:15:39.791429   11187 ethash.go:94] Making cache
I0410 13:15:40.733122   11187 ethash.go:99] Took: 941.662025ms
I0410 13:15:40.733154   11187 ethash.go:198] Retrieving DAG
I0410 13:15:42.956792   11187 ethash.go:221] DAG in '/tmp/dag' is stale. Generating new DAG (this takes a while)...
I0410 13:15:47.961026   11187 ethash.go:136] ... still generating DAG (5.004129081) ...
I0410 13:15:52.957061   11187 ethash.go:136] ... still generating DAG (10.00015064) ...
I0410 13:15:57.957225   11187 ethash.go:136] ... still generating DAG (15.00032753) ...
I0410 13:16:02.959108   11187 ethash.go:136] ... still generating DAG (20.002211787) ...
I0410 13:16:07.957681   11187 ethash.go:136] ... still generating DAG (25.000783114) ...
I0410 13:16:12.957238   11187 ethash.go:136] ... still generating DAG (30.000341044) ...
I0410 13:16:17.959675   11187 ethash.go:136] ... still generating DAG (35.002774079) ...
I0410 13:16:22.957269   11187 ethash.go:136] ... still generating DAG (40.00037278) ...
I0410 13:16:27.958990   11187 ethash.go:136] ... still generating DAG (45.002093501) ...
I0410 13:16:32.960746   11187 ethash.go:136] ... still generating DAG (50.00384482) ...
I0410 13:16:37.957171   11187 ethash.go:136] ... still generating DAG (55.00027258) ...
I0410 13:16:42.958092   11187 ethash.go:136] ... still generating DAG (60.001194505) ...
I0410 13:16:47.959810   11187 ethash.go:136] ... still generating DAG (65.002911692) ...
I0410 13:16:52.957651   11187 ethash.go:136] ... still generating DAG (70.000744781) ...
I0410 13:16:57.957628   11187 ethash.go:136] ... still generating DAG (75.000727501) ...
I0410 13:17:02.958688   11187 ethash.go:136] ... still generating DAG (80.001785787) ...
I0410 13:17:07.957231   11187 ethash.go:136] ... still generating DAG (85.000318873) ...
I0410 13:17:12.958116   11187 ethash.go:136] ... still generating DAG (90.001219351) ...
I0410 13:17:17.957537   11187 ethash.go:136] ... still generating DAG (95.000638398) ...
I0410 13:17:22.957377   11187 ethash.go:136] ... still generating DAG (100.000471432) ...
I0410 13:17:27.957623   11187 ethash.go:136] ... still generating DAG (105.000725879) ...
I0410 13:17:32.959763   11187 ethash.go:136] ... still generating DAG (110.002864159) ...
I0410 13:17:37.957228   11187 ethash.go:136] ... still generating DAG (115.000327769) ...
I0410 13:17:42.959249   11187 ethash.go:136] ... still generating DAG (120.002350666) ...
I0410 13:17:47.961931   11187 ethash.go:136] ... still generating DAG (125.005033716) ...
I0410 13:17:52.957614   11187 ethash.go:136] ... still generating DAG (130.00070955) ...
I0410 13:17:57.958102   11187 ethash.go:136] ... still generating DAG (135.001203794) ...
I0410 13:18:02.958013   11187 ethash.go:136] ... still generating DAG (140.001104057) ...
I0410 13:18:07.957391   11187 ethash.go:136] ... still generating DAG (145.000493908) ...
I0410 13:18:12.957098   11187 ethash.go:136] ... still generating DAG (150.000200194) ...
I0410 13:18:17.957493   11187 ethash.go:136] ... still generating DAG (155.000594212) ...
I0410 13:18:22.957018   11187 ethash.go:136] ... still generating DAG (160.000119456) ...
I0410 13:18:27.957397   11187 ethash.go:136] ... still generating DAG (165.00049905) ...
I0410 13:18:32.961457   11187 ethash.go:136] ... still generating DAG (170.004558368) ...
I0410 13:18:37.957127   11187 ethash.go:136] ... still generating DAG (175.000230212) ...
I0410 13:18:42.957887   11187 ethash.go:136] ... still generating DAG (180.000988222) ...
I0410 13:18:47.957252   11187 ethash.go:136] ... still generating DAG (185.000353691) ...
I0410 13:18:52.956999   11187 ethash.go:136] ... still generating DAG (190.00010146) ...
I0410 13:18:57.958784   11187 ethash.go:136] ... still generating DAG (195.001887162) ...
I0410 13:19:02.959349   11187 ethash.go:136] ... still generating DAG (200.002450369) ...
I0410 13:19:07.957348   11187 ethash.go:136] ... still generating DAG (205.000450332) ...
I0410 13:19:12.957553   11187 ethash.go:136] ... still generating DAG (210.000652405) ...
I0410 13:19:17.958218   11187 ethash.go:136] ... still generating DAG (215.001321313) ...
I0410 13:19:22.957032   11187 ethash.go:136] ... still generating DAG (220.000134133) ...
I0410 13:19:27.958131   11187 ethash.go:136] ... still generating DAG (225.00123305) ...
I0410 13:19:32.960438   11187 ethash.go:136] ... still generating DAG (230.00354206) ...
I0410 13:19:37.957569   11187 ethash.go:136] ... still generating DAG (235.000671334) ...
I0410 13:19:42.959116   11187 ethash.go:136] ... still generating DAG (240.002219419) ...
I0410 13:19:47.958325   11187 ethash.go:136] ... still generating DAG (245.001427059) ...
I0410 13:19:52.957359   11187 ethash.go:136] ... still generating DAG (250.000460169) ...
I0410 13:19:57.957493   11187 ethash.go:136] ... still generating DAG (255.000580584) ...
I0410 13:20:02.958449   11187 ethash.go:136] ... still generating DAG (260.001552279) ...
I0410 13:20:07.957358   11187 ethash.go:136] ... still generating DAG (265.0004613) ...
I0410 13:20:12.958703   11187 ethash.go:136] ... still generating DAG (270.001803993) ...
I0410 13:20:17.961947   11187 ethash.go:136] ... still generating DAG (275.005044037) ...
I0410 13:20:22.957558   11187 ethash.go:136] ... still generating DAG (280.000659476) ...
I0410 13:20:27.957559   11187 ethash.go:136] ... still generating DAG (285.00066114) ...
I0410 13:20:32.959842   11187 ethash.go:136] ... still generating DAG (290.002944041) ...
I0410 13:20:37.957616   11187 ethash.go:136] ... still generating DAG (295.000716625) ...
I0410 13:20:42.959235   11187 ethash.go:136] ... still generating DAG (300.002319082) ...
I0410 13:20:47.959442   11187 ethash.go:136] ... still generating DAG (305.002543494) ...
I0410 13:20:52.957340   11187 ethash.go:136] ... still generating DAG (310.000441424) ...
I0410 13:20:57.958807   11187 ethash.go:136] ... still generating DAG (315.001910004) ...
I0410 13:21:02.958875   11187 ethash.go:136] ... still generating DAG (320.001978041) ...
I0410 13:21:07.957340   11187 ethash.go:136] ... still generating DAG (325.000442502) ...
I0410 13:21:12.958356   11187 ethash.go:136] ... still generating DAG (330.00145741) ...
I0410 13:21:17.959081   11187 ethash.go:136] ... still generating DAG (335.002182609) ...
I0410 13:21:22.957381   11187 ethash.go:136] ... still generating DAG (340.000484321) ...
I0410 13:21:27.957972   11187 ethash.go:136] ... still generating DAG (345.001074666) ...
I0410 13:21:32.958111   11187 ethash.go:136] ... still generating DAG (350.001210183) ...
I0410 13:21:37.957127   11187 ethash.go:136] ... still generating DAG (355.000228426) ...
I0410 13:21:42.957596   11187 ethash.go:136] ... still generating DAG (360.000697576) ...
I0410 13:21:47.958315   11187 ethash.go:136] ... still generating DAG (365.001419217) ...
I0410 13:21:52.957728   11187 ethash.go:136] ... still generating DAG (370.00083073) ...
I0410 13:21:57.957119   11187 ethash.go:136] ... still generating DAG (375.000222509) ...
I0410 13:22:02.146650   11187 ethash.go:138] ... DAG generation completed ...
I0410 13:22:05.112140   11187 ethash.go:243] Took: 6m24.37896945s
I0410 13:22:35.999887   11187 chain_manager.go:544] imported 1 block(s) 0 queued in 4.113995ms. #66485 [aeec6d34 / aeec6d34]
I0410 13:22:35.999924   11187 worker.go:204] 🔨 Mined block #66485
I0410 13:22:36.000381   11187 worker.go:314] commit new work on block 66486 with 0 txs & 0 uncles

Changes for windows

To make it useable under Windows please change Following lines. Then it works for Python!

In file mmap_win32.c add following code:
#pragma comment(lib, "Shell32.lib")

and in python/core.c change the #include <alloca.h> in:
#if defined(_WIN32) || defined(WIN32) #include <malloc.h> #else #include <alloca.h> #endif

Thanks!

Unable to go get this package

go get github.com/ethereum/ethash
package github.com/ethereum/go-ethereum/logger: cannot find package "github.com/ethereum/go-ethereum/logger" in any of:
	/usr/local/Cellar/go/1.8/libexec/src/github.com/ethereum/go-ethereum/logger (from $GOROOT)
	/Users/me/go/src/github.com/ethereum/go-ethereum/logger (from $GOPATH)
package github.com/ethereum/go-ethereum/logger/glog: cannot find package "github.com/ethereum/go-ethereum/logger/glog" in any of:
	/usr/local/Cellar/go/1.8/libexec/src/github.com/ethereum/go-ethereum/logger/glog (from $GOROOT)
	/Users/me/go/src/github.com/ethereum/go-ethereum/logger/glog (from $GOPATH)

Update pypi with latest release.

The latest version of this code on pypi is not up to date with what can be found in the releases tab. This caused me some confusion and headache when working with the pyethereum library.

GPU fail: Intel HD Graphics 4600

ethminer/ethminer -M -G -v 20
[OPENCL]:Found suitable OpenCL device [Intel(R) HD Graphics Haswell GT2 Desktop] with 2147483648 bytes of GPU memory
  ◇  15:15:37|ethminer  #00004000…
Benchmarking on platform: { "platform": "Intel Gen OCL Driver", "device": "Intel(R) HD Graphics Haswell GT2 Desktop", "version": "OpenCL 1.2 beignet 1.0.2" }
Preparing DAG...
  ◇  15:15:40|ethminer  Farm::setWork()
  ◇  15:15:40|ethminer  start()
  ℹ  15:15:40|gpuminer0  workLoop 0 #00000000… #00000000…
  ℹ  15:15:40|gpuminer0  Initialising miner...
Warming up...
[OPENCL]:Using platform: Intel Gen OCL Driver
[OPENCL]:Using device: Intel(R) HD Graphics Haswell GT2 Desktop(OpenCL 1.2 beignet 1.0.2)
[OPENCL]:Printing program log
[OPENCL]:
[OPENCL]:Created one big buffer for the DAG
[OPENCL]:Loading single big chunk kernels
[OPENCL]:Creating buffer for header.
[OPENCL]:Mapping one big chunk.
[OPENCL]:Creating mining buffer 0
[OPENCL]:Creating mining buffer 1
drm_intel_gem_bo_context_exec() failed: Invalid argument
[OPENCL]:clEnqueueNDRangeKernel(-5)
Trial 1... 0

don't return null when dag file mismatch

The code below should either re-run the creation with force, delete the file and rerun, or inform the user to delete the file. Otherwise there is no way to determine what was wrong -- and a dag created by previous version of the software will fail.

if (file_size != found_size - ETHASH_DAG_MAGIC_NUM_SIZE) {
                fclose(f);
                ret = ETHASH_IO_MEMO_SIZE_MISMATCH;
                goto free_memo;
            }

amazon linux: Running setup.py install for pyethash ... error

$ uname -a
Linux ip-[redacted].ec2.internal 6.1.19-30.43.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Mar 15 14:44:28 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Running setup.py install for pyethash ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for pyethash did not run successfully.
  │ exit code: 1
  ╰─> [7 lines of output]
      /home/ec2-user/.pyenv/versions/ape/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      src/python/core.c:1:10: fatal error: Python.h: No such file or directory
          1 | #include <Python.h>
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

compile error

The following error occurred while compiling the project by go build command.

../../ethereum/ethash/ethash.go:25:2: cannot find package "github.com/ethereum/go-ethereum/ethutil" in any of:
	/go/src/github.com/ethereum/go-ethereum/ethutil (from $GOROOT)
	/root/go/src/github.com/ethereum/go-ethereum/ethutil (from $GOPATH)
../../ethereum/ethash/ethash.go:26:2: cannot find package "github.com/ethereum/go-ethereum/logger" in any of:
	/go/src/github.com/ethereum/go-ethereum/logger (from $GOROOT)
	/root/go/src/github.com/ethereum/go-ethereum/logger (from $GOPATH)
../../ethereum/ethash/ethash.go:27:2: cannot find package "github.com/ethereum/go-ethereum/pow" in any of:
	/go/src/github.com/ethereum/go-ethereum/pow (from $GOROOT)
	/root/go/src/github.com/ethereum/go-ethereum/pow (from $GOPATH)

I looked at this project with the name go-ethereum and he removed the above three modules in the latest version.

Fix version numbers

The current setup.py sets the version number to 0.1.23, whereas the current PyPI version of this package is listed as version 0.1.27. Why is this a problem? Because the PyPI version does not contain the endian fix that the github version has, which means that anyone trying to install this via PyPI on a big endian system is gonna have two problems: The first is that the PyPI package fails to build. This is easily worked around by cloning from github and installing with python setup.py install. The second problem is that other ethereum python packages (like py-evm) assume that the latest version of pyethash is the best and they want a version >=0.1.27. To fix that you have to clone py-evm and then edit the setup.py to force the version from the ethash repo, 0.1.23.

I think this can be fixed by bumping the version number here to 0.1.28, and then updating the pypi package.

Alloca.h

Failing on install with fatal error code C1083.. Could we remove #include<alloca.h> from core.c in src/pytho

not able to make benchmark_full

getting below errors

========================================================================

[root@localhost build]# make Benchmark_FULL
[ 71%] Built target ethash
Scanning dependencies of target Benchmark_FULL
[ 85%] Building CXX object src/benchmark/CMakeFiles/Benchmark_FULL.dir/benchmark.cpp.o
/home/project_ethash/ethash_by_xilix/ethash/src/benchmark/benchmark.cpp: In function ‘int main()’:
/home/project_ethash/ethash_by_xilix/ethash/src/benchmark/benchmark.cpp:108:2: error: ‘ethash_params’ was not declared in this scope
ethash_params params;
^
/home/project_ethash/ethash_by_xilix/ethash/src/benchmark/benchmark.cpp:108:16: error: expected ‘;’ before ‘params’
ethash_params params;
^
/home/project_ethash/ethash_by_xilix/ethash/src/benchmark/benchmark.cpp:109:22: error: ‘params’ was not declared in this scope
ethash_params_init(&params, 0);
^
/home/project_ethash/ethash_by_xilix/ethash/src/benchmark/benchmark.cpp:109:31: error: ‘ethash_params_init’ was not declared in this scope
ethash_params_init(&params, 0);
^
/home/project_ethash/ethash_by_xilix/ethash/src/benchmark/benchmark.cpp:129:2: error: ‘ethash_cache’ was not declared in this scope
ethash_cache cache;
^
/home/project_ethash/ethash_by_xilix/ethash/src/benchmark/benchmark.cpp:129:15: error: expected ‘;’ before ‘cache’
ethash_cache cache;
^
/home/project_ethash/ethash_by_xilix/ethash/src/benchmark/benchmark.cpp:130:2: error: ‘cache’ was not declared in this scope
cache.mem = cache_mem;
^
/home/project_ethash/ethash_by_xilix/ethash/src/benchmark/benchmark.cpp:135:40: error: ‘ethash_mkcache’ was not declared in this scope
ethash_mkcache(&cache, &params, &seed);
^
/home/project_ethash/ethash_by_xilix/ethash/src/benchmark/benchmark.cpp:146:58: error: invalid use of incomplete type ‘struct ethash_light’
ethash_light(&hash, &cache, &params, &previous_hash, 0);
^
In file included from /home/project_ethash/ethash_by_xilix/ethash/src/benchmark/benchmark.cpp:25:0:
/home/project_ethash/ethash_by_xilix/ethash/src/benchmark/../libethash/ethash.h:58:8: error: forward declaration of ‘struct ethash_light’
struct ethash_light;
^
/home/project_ethash/ethash_by_xilix/ethash/src/benchmark/benchmark.cpp:153:54: error: ‘ethash_compute_full_data’ was not declared in this scope
ethash_compute_full_data(full_mem, &params, &cache);
^
/home/project_ethash/ethash_by_xilix/ethash/src/benchmark/benchmark.cpp:175:58: error: invalid use of incomplete type ‘struct ethash_full’
ethash_full(&hash, full_mem, &params, &previous_hash, 0);
^
In file included from /home/project_ethash/ethash_by_xilix/ethash/src/benchmark/benchmark.cpp:25:0:
/home/project_ethash/ethash_by_xilix/ethash/src/benchmark/../libethash/ethash.h:60:8: error: forward declaration of ‘struct ethash_full’
struct ethash_full;
^
/home/project_ethash/ethash_by_xilix/ethash/src/benchmark/benchmark.cpp:248:64: error: invalid use of incomplete type ‘struct ethash_full’
ethash_full(&hash, full_mem, &params, &previous_hash, nonce);
^
In file included from /home/project_ethash/ethash_by_xilix/ethash/src/benchmark/benchmark.cpp:25:0:
/home/project_ethash/ethash_by_xilix/ethash/src/benchmark/../libethash/ethash.h:60:8: error: forward declaration of ‘struct ethash_full’
struct ethash_full;
^
make[3]: *** [src/benchmark/CMakeFiles/Benchmark_FULL.dir/benchmark.cpp.o] Error 1
make[2]: *** [src/benchmark/CMakeFiles/Benchmark_FULL.dir/all] Error 2
make[1]: *** [src/benchmark/CMakeFiles/Benchmark_FULL.dir/rule] Error 2
make: *** [Benchmark_FULL] Error 2
[root@localhost build]#

ethash/AMD APP SDK

I got a rig where i have installed the AMD APP SDK 2.9.1 and it seems i get no blocks. CPU usage max 12%
On another rig i don’t have the AMD APP SDK installed , i get blocks , but my ethminer crashes at 100% CPU load.

Same hashrate for both rigs, 150MH, one gets blocks the other doesn't.

Describe what this code base is, in the Read Me and repository description

The Read Me document currently does not say what this code base is.

A link to the Ethash algorithm page, does not say what this code base is. Is it an implemnetation? In what languages? There is a lot of C, C++ JavaScript, Python, Go language code; is it a library implementation for all of those? The Read Me document does not say.

The repository's description and the Read Me can say a simple sentence, like “JSEthash is an implementation of the Ethash algorithm for JavaScript” (or whatever is actually true for this code base).

fatal error C1083: Cannot open include file: 'alloca.h

src/python/core.c(2): fatal error C1083: Cannot open include file: 'alloca.h

': No such file or directory
error: command 'E:\apps\Visual Studio 2015\VC\BIN\x86_amd64\cl.exe' fa
iled with exit status 2

I get this error when trying to pip install pyethash

Unable to go get this package

go get github.com/ethereum/ethash

And get error

package github.com/ethereum/go-ethereum/pow: cannot find package "github.com/ethereum/go-ethereum/pow" in any of:
/usr/lib/go-1.6/src/github.com/ethereum/go-ethereum/pow (from $GOROOT)
/root/go/src/github.com/ethereum/go-ethereum/pow (from $GOPATH)

Add simple instructions for dependencies, build, and install

There is no top-level document (e.g. the Read Me) stating how to satisfy dependencies, build, and install this code base.

There are CMake files, a Distutils script, a Vagrantfile, a Makefile. Which of those should the recipient use to satisfy build dependencies? What commands to run for building, for installing?

A simple text in the Read Me document (or, if they are more complex, maybe a separate INSTALL document) that says something like:

Get build dependencies:

    $ python3 -m pip install foo bar baz

Build this code base:

    $ cmake lorem/
    $ python3 -m setup build

Install the library:

    $ make install

would be enough to satisfy the recipient's need to know how to do those things.

unable to install pyethash

Running setup.py install for pyethash ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\mohsin\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Mohsin\AppData\Local\Temp\pip-install-yfm6_fjc\pyethash_25ac1e12a7a742309e1303ec7f4164a4\setup.py'"'"'; file='"'"'C:\Users\Mohsin\AppData\Local\Temp\pip-install-yfm6_fjc\pyethash_25ac1e12a7a742309e1303ec7f4164a4\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Mohsin\AppData\Local\Temp\pip-record-cgsqj6of\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\mohsin\appdata\local\programs\python\python39\Include\pyethash'
cwd: C:\Users\Mohsin\AppData\Local\Temp\pip-install-yfm6_fjc\pyethash_25ac1e12a7a742309e1303ec7f4164a4
Complete output (27 lines):
running install
running build
running build_ext
building 'pyethash' extension
creating build
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\src
creating build\temp.win-amd64-3.9\Release\src\libethash
creating build\temp.win-amd64-3.9\Release\src\python
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\mohsin\appdata\local\programs\python\python39\include -Ic:\users\mohsin\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt /Tcsrc/libethash/internal.c /Fobuild\temp.win-amd64-3.9\Release\src/libethash/internal.obj -Isrc/ -std=gnu99 -Wall
cl : Command line warning D9002 : ignoring unknown option '-std=gnu99'
internal.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\corecrt.h(212): warning C4668: '__cplusplus' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h(1833): warning C4710: 'int sprintf_s(char *const ,const size_t,const char *const ,...)': function not inlined
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h(1833): note: see declaration of 'sprintf_s'
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\mohsin\appdata\local\programs\python\python39\include -Ic:\users\mohsin\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt /Tcsrc/libethash/io.c /Fobuild\temp.win-amd64-3.9\Release\src/libethash/io.obj -Isrc/ -std=gnu99 -Wall
cl : Command line warning D9002 : ignoring unknown option '-std=gnu99'
io.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\corecrt.h(212): warning C4668: '__cplusplus' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h(1833): warning C4710: 'int sprintf_s(char *const ,const size_t,const char *const ,...)': function not inlined
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h(1833): note: see declaration of 'sprintf_s'
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\mohsin\appdata\local\programs\python\python39\include -Ic:\users\mohsin\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt /Tcsrc/libethash/io_win32.c /Fobuild\temp.win-amd64-3.9\Release\src/libethash/io_win32.obj -Isrc/ -std=gnu99 -Wall
cl : Command line warning D9002 : ignoring unknown option '-std=gnu99'
io_win32.c
c1: fatal error C1083: Cannot open source file: 'src/libethash/io_win32.c': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\mohsin\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Mohsin\AppData\Local\Temp\pip-install-yfm6_fjc\pyethash_25ac1e12a7a742309e1303ec7f4164a4\setup.py'"'"'; file='"'"'C:\Users\Mohsin\AppData\Local\Temp\pip-install-yfm6_fjc\pyethash_25ac1e12a7a742309e1303ec7f4164a4\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Mohsin\AppData\Local\Temp\pip-record-cgsqj6of\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\mohsin\appdata\local\programs\python\python39\Include\pyethash' Check the logs for full command output.

Windows - libethash - multiple concurrent miners crash application

Attempting to run multiple separate miners in Windows (7/8/10) crashes out. After initial miner started any subsequent miner will fail when attempting to open the DAG. This isn't happening in Linux.

The issue is that the ethash_fopen function in io_win32.c calls fopen_s which opens files exclusively in Windows environment. I suggest we could change:

FILE* ethash_fopen(char const* file_name, char const* mode)
{
	FILE* f;
	return fopen_s(&f, file_name, mode) == 0 ? f : NULL;
}

to

FILE* ethash_fopen(char const* file_name, char const* mode)
{
	return _fsopen( file_name, mode, _SH_DENYNO );
}

I've changed and tested this locally and have had no issues so far with it.

Let me know if you'd like my to open a pull request with the change in place for review. I'm new to contributing to github projects so I'm not up to speed on good etiquette...

Problem with using with Python for Windows. Please adapt compiler options…

As you know, pip3 is now supported and installed along the Python .msi installer.
The only compiler which can be used with the pip version installed with Python for Windows is the official ones from Visual Studio (because this the compiler used to compile Python for Windows and because of differences with other Systems compilers should be the same as the one used to build Python).

As result :

  Running setup.py install for pyethash ... error
    Complete output from command "c:\program files\python37\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\example\\AppData\\Local\\Temp\\pip-install-209nknj4\\pyethash\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\example\AppData\Local\Temp\pip-record-5buii9qu\install-record.txt --single-version-externally-managed --compile:
      running install
      running build
      running build_ext
      building 'pyethash' extension
      creating build
      creating build\temp.win-amd64-3.7
      creating build\temp.win-amd64-3.7\Release
      creating build\temp.win-amd64-3.7\Release\src
      creating build\temp.win-amd64-3.7\Release\src\python
      creating build\temp.win-amd64-3.7\Release\src\libethash
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-Ic:\program files\python37\include" "-Ic:\program files\python37\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /Tcsrc/python/core.c /Fobuild\temp.win-amd64-3.7\Release\src/python/core.obj -Isrc/ -std=gnu99 -Wall
      clÿ: Ligne de commande warning D9002ÿ: option '-std=gnu99' inconnue ignor‚e
      core.c
      C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt_io.h(49): warning C4820: '_finddata32i64_t'ÿ: '4' octets de remplissage ajout‚s aprŠs donn‚es membres 'name'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt_io.h(54): warning C4820: '_finddata64i32_t'ÿ: '4' octets de remplissage ajout‚s aprŠs donn‚es membres 'attrib'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt_io.h(64): warning C4820: '__finddata64_t'ÿ: '4' octets de remplissage ajout‚s aprŠs donn‚es membres 'attrib'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt_io.h(69): warning C4820: '__finddata64_t'ÿ: '4' octets de remplissage ajout‚s aprŠs donn‚es membres 'name'
      c:\program files\python37\include\pyconfig.h(203): fatal error C1083: Impossible d'ouvrir le fichier includeÿ: 'basetsd.h'ÿ: No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.20.27508\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

      ----------------------------------------
  Command ""c:\program files\python37\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\example\\AppData\\Local\\Temp\\pip-install-209nknj4\\pyethash\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\example\AppData\Local\Temp\pip-record-5buii9qu\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\example\AppData\Local\Temp\pip-install-209nknj4\pyethash\

Which is normal since ‑std=gnu99 is a ɢɴᴜ gcc’s compiler option…

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.