Git Product home page Git Product logo

Comments (3)

ikwzm avatar ikwzm commented on August 27, 2024 1

I wonder however if this is correct... in the test_1 it didn't increment in the array. I added it, however... I am also curious about why the range of iis only from 0 to 9... should it not be 0 totest_size-1 ?

The argument a of test_1 is a numpy array.
Thus, a *= 0 clears the entire contents of the array, and a += 0x31 adds 0x31 to each element of the array.
This is repeated 10 times and the time it takes is measured.

from udmabuf.

sapertuz avatar sapertuz commented on August 27, 2024

I solved it... the code should call the attribute udmabuf.array instead.
There were also some code typos that I fixed here:

from udmabuf import Udmabuf
import numpy as np
import time
def test_1(a):
    for i in range (0,9):
        a[i] *= 0
        a[i] += 0x31
if __name__ == '__main__':
    udmabuf      = Udmabuf('udmabuf0')
    test_dtype   = np.uint8
    test_size    = udmabuf.buf_size//(np.dtype(test_dtype).itemsize)
    comparison   = np.zeros(test_size, dtype=test_dtype)
    udmabuf.memmap(dtype=test_dtype, shape=(test_size))
    print ("test_size  : %d" % test_size)
    start        = time.time()
    test_1(udmabuf.array)
    elapsed_time = time.time() - start
    print ("udmabuf-0   : elapsed_time: {0}".format(elapsed_time) + " sec" )
    start        = time.time()
    test_1(comparison)
    elapsed_time = time.time() - start
    print ("comparison : elapsed_time:  {0}".format(elapsed_time) + " sec")
    if np.array_equal(udmabuf.array, comparison):
        print ("udmabuf-0 == comparison : OK")
    else:
        print ("udmabuf-0 != comparison : NG")

I wonder however if this is correct... in the test_1`` it didn't increment in the array. I added it, however... I am also curious about why the range of iis only from 0 to 9... should it not be 0 totest_size-1``` ?

Btw, feel free to use the code to be included in your readme file :)

from udmabuf.

ikwzm avatar ikwzm commented on August 27, 2024

Thank you for the issue.

Readme.md was corrected.

from udmabuf.

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.