I have some functions in Python and it runs very slow compared to C.
The sage I want to do with the GPU is as follows
E = EllipticCurve (GF (P), [0,7])
N = E.order ()
G = E(55066263022277343669578718895168534326250603453777594175500187360389116729240,32670510020758816978083085130507043184471273380659243275938904335757337482424) # on E
T = E(26864879445837655118481716049217967286489564259939711339119540571911158650839,29571359081268663540055655726653840143920402820693420787986280659961264797165) # on E
numInt = 5646546546563131314723897429834729834798237429837498237498237489273948728934798237489723489723984729837489237498237498237498237498273493729847
numMod = numInt %N
numInv = pow(numMod ,N-2,N) # detail -> https://stackoverflow.com/questions/59234775/how-to-calculate-2-to-the-power-of-a-large-number-modulo-another-large-number
numMod * G
numMod * T
(T-G) * numInv
print (5*T)
print (2*G)
print (numMod * G)
print (numMod * (-G))
print (numMod * T)
print ((numMod-3) * (T-G))
Do you have any suggestions? What should I do ?
I wrote my question here because it is indirectly related to this project. Please forgive.
Hi! The slowest part in your python is inverse function. Try to implement gmpy2 inverse function (included in gmpy2) - it is C-based and very fast:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#gmpy
You can find the details here: https://bitcointalksearch.org/topic/m.55214449
When using Python, I use FastEcdsa(https://github.com/AntonKueltz/fastecdsa) library and mathematics similar to Sage. But can I do the math faster? I want to understand.
The FastEcdsa Library is fast, but I don't know if it uses the gmpy2 you suggested. My python script uses 17% of the CPU as a result. I wanted to write with Anaconda (for GPU), but I could not find a gpu running as fast as C or I could not.
Thank you MrFreeDragon .