user@localhost:~$ optirun python3 test_cumath.py
Traceback (most recent call last):
File "test_cumath.py", line 245, in <module>
from py.test.cmdline import main
ImportError: No module named 'py'
module py is actually pytest. So install away
First run is very slow, I have no idea why. Then I run tests again.
tests average at 8.5seconds, pretty good. Then I add some code to print the time of the cpu and gpu, looks to me the maths test, cpu perform much better.
Have fun and you can get the code from my repository.
user@localhost:~$ sudo apt-get install python3-pytest
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libgl1-nvidia-glx:i386 libgl1-nvidia-glx-i386:i386 libllvm3.5v5 libnvidia-glcore:i386 linux-image-4.1.0-2-amd64 linux-image-4.2.0-1-amd64 linux-source-4.3 python3-ecdsa syslinux
unetbootin-translations
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
python3-py
The following NEW packages will be installed:
python3-py python3-pytest
0 upgraded, 2 newly installed, 0 to remove and 508 not upgraded.
Need to get 249 kB of archives.
After this operation, 962 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ftp.us.debian.org/debian testing/main amd64 python3-py all 1.4.31-1 [81.9 kB]
Get:2 http://ftp.us.debian.org/debian testing/main amd64 python3-pytest all 2.9.2-3 [167 kB]
Fetched 249 kB in 6s (36.0 kB/s)
Selecting previously unselected package python3-py.
(Reading database ... 285403 files and directories currently installed.)
Preparing to unpack .../python3-py_1.4.31-1_all.deb ...
Unpacking python3-py (1.4.31-1) ...
Selecting previously unselected package python3-pytest.
Preparing to unpack .../python3-pytest_2.9.2-3_all.deb ...
Unpacking python3-pytest (2.9.2-3) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up python3-py (1.4.31-1) ...
Setting up python3-pytest (2.9.2-3) ...
user@localhost:~$ optirun python3 -mpytest test_cumath.py
==================================================================================== test session starts =====================================================================================
platform linux -- Python 3.5.2+, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
rootdir: /home/user/, inifile:
collected 28 items
test_cumath.py ............................
================================================================================ 28 passed in 106.94 seconds =================================================================================
First run is very slow, I have no idea why. Then I run tests again.
user@localhost:~$ optirun python3 -s -mpytest test_cumath.py ==================================================================================== test session starts ===================================================================================== platform linux -- Python 3.5.2+, pytest-2.9.2, py-1.4.31, pluggy-0.3.1 rootdir: /home/user/, inifile: collected 28 items test_cumath.py ............................ ================================================================================= 28 passed in 8.43 seconds ================================================================================== user@localhost:~/oss/asus-rt-n14uhp-mrtg/src/pycuda$ optirun python3 -s -mpytest test_cumath.py ==================================================================================== test session starts ===================================================================================== platform linux -- Python 3.5.2+, pytest-2.9.2, py-1.4.31, pluggy-0.3.1 rootdir: /home/user/, inifile: collected 28 items test_cumath.py ............................ ================================================================================= 28 passed in 8.44 seconds ==================================================================================
tests average at 8.5seconds, pretty good. Then I add some code to print the time of the cpu and gpu, looks to me the maths test, cpu perform much better.
name="<class 'numpy.float32'>" cpu time="0.00000230599835049360990524291992187500000000000000" gpu time="0.00008139800047501921653747558593750000000000000000"
name="<class 'numpy.float64'>" cpu time="0.00000265298876911401748657226562500000000000000000" gpu time="0.00008218799484893679618835449218750000000000000000"
name="<class 'numpy.float32'>" cpu time="0.00000343500869348645210266113281250000000000000000" gpu time="0.00007703299343120306730270385742187500000000000000"
name="<class 'numpy.float64'>" cpu time="0.00000536799780093133449554443359375000000000000000" gpu time="0.00008030000026337802410125732421875000000000000000"
name="<class 'numpy.float32'>" cpu time="0.00001179199898615479469299316406250000000000000000" gpu time="0.00007762899622321128845214843750000000000000000000"
name="<class 'numpy.float64'>" cpu time="0.00002014498750213533639907836914062500000000000000" gpu time="0.00010288099292665719985961914062500000000000000000"
name="<class 'numpy.float32'>" cpu time="0.00001173198688775300979614257812500000000000000000" gpu time="0.00007860400364734232425689697265625000000000000000"
name="<class 'numpy.float64'>" cpu time="0.00001884899393189698457717895507812500000000000000" gpu time="0.00007704700692556798458099365234375000000000000000"
name="<class 'numpy.float32'>" cpu time="0.00007372199615929275751113891601562500000000000000" gpu time="0.00008238101145252585411071777343750000000000000000"
name="<class 'numpy.float64'>" cpu time="0.00014613500388804823160171508789062500000000000000" gpu time="0.00016600399976596236228942871093750000000000000000"
Have fun and you can get the code from my repository.
No comments:
Post a Comment