Giter VIP home page Giter VIP logo

Comments (23)

pooler avatar pooler commented on August 22, 2024

I seriously doubt that would make hashing any faster on the architectures for which we already have assembly code (ARM, x86, x86-64).
When mining, you don't need to compute a full hash, but only part of it, and that allows for significant optimizations. Another important problem with relying on an external API is that it may make it impossible to take full advantage of SIMD processing.
That said, I admittedly have no direct experience with the Linux Crypto API, so feel free to prove me wrong. :-)

from cpuminer.

alphaonex86 avatar alphaonex86 commented on August 22, 2024

For my bench (openssl and dm-crypt), I have 4x more performance (and openssl/dm-crypt have too already asl in user space), because in kernel space you don't check the memory acces (trusted zone vs not trused zone).
Test that's can be very interesting...

from cpuminer.

pooler avatar pooler commented on August 22, 2024

For my bench (openssl and dm-crypt), I have 4x more performance

For what algorithm and data size, and on what kind of hardware?

I have just run some quick and dirty benchmarks (based on this example), and the performance of SHA-256 on small data (80 bytes) was far from satisfactory on my system. But then again, this is the first time I've used this API, so I may well be missing something.

from cpuminer.

alphaonex86 avatar alphaonex86 commented on August 22, 2024

aes256 and aes512, on volume of GB, on intel atom z530 and core i5 750.
I think you need send multiple syscall to send multiple work to do and turn the work to do.

from cpuminer.

pooler avatar pooler commented on August 22, 2024

Such a performance increase makes sense if you are processing large streams of data, but for mining we are only interested in hashing very small quantities of data at a time.

from cpuminer.

alphaonex86 avatar alphaonex86 commented on August 22, 2024

I think if it's have implemented that's for simple sha256, it's useful, because it's some work, more syscall, ...

from cpuminer.

pooler avatar pooler commented on August 22, 2024

I'm sorry but I am missing something in translation here... Could you please clarify?

from cpuminer.

alphaonex86 avatar alphaonex86 commented on August 22, 2024

I don't think the kernel do useless code. Maybe a queue of work can be transmited?

from cpuminer.

pooler avatar pooler commented on August 22, 2024

I never meant to insinuate that the kernel code or the API are useless. I can see plenty of use cases for the Crypto API, but that doesn't mean mining has to be one of them.
I don't know if there's a way to pass our data to the API in a way that would result in much faster hashing than what I tried above, as unfortunately I could find no real documentation.

from cpuminer.

alphaonex86 avatar alphaonex86 commented on August 22, 2024

For scrypt algo, the memory latency is very important no? gdb vs valgrind, kvm user space vs kernel space (without hardware virtualisation), ... all for that's have greate memory improvement into the kernel.
scrypt is mentionned here:
https://wiki.archlinux.org/index.php/Disk_Encryption
cryptsetup benchmark show greate improvement on usage of kernel space for sha512 and sha256;
5x on PBKDF2-sha512 on my core i5 750, 7x on my Intel Atom z530

from cpuminer.

pooler avatar pooler commented on August 22, 2024

This is all very interesting, but I won't be convinced until someone shows me an actual preliminary benchmark comparison for an algorithm and data size that are pertinent to this project.

from cpuminer.

alphaonex86 avatar alphaonex86 commented on August 22, 2024

On an AMD with kernel crypto API:
cryptsetup benchmark
PBKDF2-sha1 493679 iterations per second
PBKDF2-sha256 431868 iterations per second
PBKDF2-sha512 368697 iterations per second
PBKDF2-ripemd160 457493 iterations per second
PBKDF2-whirlpool 185654 iterations per second
With user space asm (gcrypt):
PBKDF2-sha1 344473 iterations per second
PBKDF2-sha256 189959 iterations per second
PBKDF2-sha512 127254 iterations per second
PBKDF2-ripemd160 276523 iterations per second
PBKDF2-whirlpool 134295 iterations per second

from cpuminer.

pooler avatar pooler commented on August 22, 2024

A cryptsetup benchmark is not relevant in our case. You need to provide a benchmark against the code that is currently in cpuminer.

from cpuminer.

alphaonex86 avatar alphaonex86 commented on August 22, 2024

I'm not sure understand the query. I'm not able to change cpuminer to use correctly this API.
While(1000){syscall with crypto API} -> product bad latency, you need do this loop into the kernel.

from cpuminer.

alphaonex86 avatar alphaonex86 commented on August 22, 2024

crypto API was used by bfgminer, then you have the code of usage into it.

from cpuminer.

pooler avatar pooler commented on August 22, 2024

Could you please point out where exactly in the source code of bfgminer you think the Crypto API is called?

from cpuminer.

alphaonex86 avatar alphaonex86 commented on August 22, 2024

https://github.com/luke-jr/bfgminer/blob/bfgminer/driver-cpu.c scanhash_c() have scanhash_cryptopp() is usefull too

from cpuminer.

pooler avatar pooler commented on August 22, 2024

That's not using the Crypto API at all. scanhash_c() is defined in sha256_generic.c, and scanhash_cryptopp() is defined in sha256_cryptopp.c.

from cpuminer.

alphaonex86 avatar alphaonex86 commented on August 22, 2024

then the --help is wrong, or I don't know read it, sorry.

from cpuminer.

pooler avatar pooler commented on August 22, 2024

The --help text is correct: scanhash_c() corresponds to "Linux kernel sha256, implemented in C". That means that the C code was copied from the Linux kernel, not that the miner offloads hashing to the kernel.

from cpuminer.

alphaonex86 avatar alphaonex86 commented on August 22, 2024

:( I case of my cubox-i, I can enable CAAN (no graphic, ... but not important on server), only enable with the crypto API... then bad luck...

from cpuminer.

pooler avatar pooler commented on August 22, 2024

This doesn't seem to be going anywhere, so I'm closing this ticket for now.
I appreciate your good intentions, but I still stand by what I wrote in my first reply.

from cpuminer.

alphaonex86 avatar alphaonex86 commented on August 22, 2024

name : sha256
driver : sha256-caam
type : ahash
Then like amd crypto graphic co processor an hardware acelerator, very more fast than the cpu.

from cpuminer.

Related Issues (20)

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.