From Documentation
Jump to: navigation, search
 
(11 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Getting an Account with SHARCNET and Related Issues ==
+
{{Template:CCMissing}}
 +
The header titles get automatically converted into tab titles.
  
=== What is required to obtain a SHARCNET account ===
 
  
Anyone who would like to use SHARCNET may apply for an account. Please bear in mind the following:
+
<hr>
 +
<big>'''PyCUDA''' makes it possible to easily use CUDA inside Python code.</big>
  
*There are no shared/group accounts, each person who uses SHARCNET requires their own account and must not share their password
+
Documentation can be found on the [http://mathema.tician.de/software/pycuda package webpage].
*Applicants who are not a primary investigator (eg. students) require an account sponsor who must already have a SHARCNET account.  This is typically one's supervisor.
+
*There is no fee for academic access, but account sponsors are responsible for [[Knowledge_Base#How_do_I_update_my_account.3F|reporting their research activities to Compute Canada]], and all academic SHARCNET users must obtain a Compute Canada account before they may apply for a SHARCNET account.
+
*All SHARCNET users must read and follow the policies listed [http://www.sharcnet.ca/my/systems/policies here]
+
  
=== How do I apply for an account? ===
+
This package is not currently installed as SHARCNET-supported software, but it's easy for users to install it on their own following instructions below.  If any difficulties are encountered when following these instructions, please ask SHARCNET staff for help.
  
Applying for an account is either done through the Compute Canada Database (for academic users) or by contacting SHARCNET (for non-academic use). Detailed step-by-step instructions are provided on the [[Getting_an_Account_with_SHARCNET]] page.
+
See also: [[PyOpenCL]]
  
=== How do I update / renew my account? ===
+
==SHARCNET installation instructions==
  
It is no longer necessary to report to SHARCNET.  SHARCNET accounts (for academic users) are automatically activated or deactivated based on the status of your primary role with Compute Canada (your primary CCRI), so as long as one ensures that they have completed the Compute Canada account renewal and reporting process their SHARCNET account will be in good standing.
+
===Monk cluster===
 +
(These instructions were tested on Oct 22, 2014 )
  
Compute Canada account holders may renew their account at any time, even after it has been expired, by visiting the CCDB and [https://ccdb.computecanada.ca/account_renewal filling out their renewal form]. Note that it may take 3-4 business days for your renewal to be confirmed by an account authority at Compute Canada.  Note that if you are a sponsored user, you must email us at help@sharcnet.ca to have your SHARCNET account reactivated following expiry.
+
1. Unload the Intel compiler module (loaded by default), so that GCC becomes the default compiler. Also, use a later python version.
 +
<source lang="bash">
 +
module unload intel
 +
module unload openmpi
 +
module load gcc/4.8.2
 +
module load openmpi/gcc/1.8.1
 +
module load python/gcc/2.7.8
 +
</source>
 +
Note: openmpi module is loaded because the python module needs it (it is not actually used by PyCuda)
  
If anything is unclear or if you have any questions about the Compute Canada account renewal / reporting process please email [mailto:accounts@computecanada.ca accounts@computecanada.ca].  If you have any questions about account renewals that directly pertain to SHARCNET please email [mailto:help@sharcnet.ca help@sharcnet.ca].
 
  
=== I am changing supervisor or I am becoming faculty, and I already have a SHARCNET account. Should I apply for a new account? ===
+
2. Create some directory you want to build the package in, cd into it, then get the PyCUDA source code:
No, you should apply for a new role (CCRI) and indicate that you want your new role to be your primary role.  The process is described in detail on the [[Getting_an_Account_with_SHARCNET]]  page.
+
  
=== I have an existing SHARCNET account and need to link it to a new Compute Canada account, how do I do that? ===
+
<source lang="bash">
 +
git clone http://git.tiker.net/trees/pycuda.git
 +
cd pycuda
 +
git submodule init
 +
git submodule update
  
You first need to get a Compute Canada Role Identifier (CCRI) and then notify SHARCNET that you would like to link your Compute Canada Account (CCI) to your existing SHARCNET account. Detailed step-by-step instructions are provided on the [[Getting_an_Account_with_SHARCNET]] page.
+
wget https://pypi.python.org/packages/source/p/pycuda/pycuda-2014.1.tar.gz#md5=fdc2f59e57ab7256a7e0df0d9d943022
 +
tar xfz pycuda-2014.1.tar.gz
 +
cd pycuda-2014.1
  
=== What is a role / CCRI ? ===
+
</source>
  
A role (CCRI: Compute Canada Role Identifier) is a way to identify you as a person at a point in timeIt includes information your position, institution and department, as well as any other roles that sponsor your role or that your role sponsor's.
+
3. At this point decide where you want the package to be installed.  In this example will use a directory called python_packages in the home directoryIf this directory does not yet exist, make it with:
  
Each person may have one or more roles that are associated with each of their current and past positions.  These various roles ultimately link back to ones CCI (<i>Compute Canada Identifier</i>).  
+
<source lang="bash">
 +
mkdir -p ~/python_packages/lib/python/
 +
</source>
 +
Doing it this way creates the required subdirectories as well.
  
If the roles are created through Compute Canada they are referred to as a CCRI (<i>Compute Canada Role Identifier</i>), although other roles pre-dating Compute Canada also exist. 
+
4. Edit file Makefile.in to add --home flag pointing to the directory you created to the setup install line, so that it reads:
 +
<source lang="bash">
 +
${PYTHON_EXE} setup.py install --home=~/python_packages
 +
</source>
  
In practice you only need to be concerned with your role (and the appropriate role from your sponsor) when applying for accounts, running jobs in particular projects associated with a particular group/sponsor, or when viewing the SHARCNET web portal with multiple roles (you may see different information in the web portal depending on which role you have selected to be <i>active</i>). 
+
5.You now need to update the PYTHONPATH variable to point to the library directory:
 +
<source lang="bash">
 +
export PYTHONPATH=~/python_packages/lib/python/:$PYTHONPATH
 +
</source>
  
For further information about roles please see the SHARCNET-specific role information [https://www.sharcnet.ca/my/profile/what_is_a_role here] and the more general Compute Canada specific information [https://ccdb.computecanada.ca/me/faq#what_is_role here].
+
6. Configure and compile, providing a path to the CUDA files on monk:
  
=== Can I just have a cluster account without having a web portal account? ===
+
<source lang="bash">
No. The web portal account is an online interface to your account in our user database. It provides a way of managing your information and keeping track of problems you may encounter.  
+
python configure.py --cuda-root=/opt/sharcnet/cuda/6.0.37/toolkit
 +
make install
 +
</source>
  
=== Can I E-mail or call to open an account? ===
+
7. Do the first test of the installation to make sure the pycuda module can be imported, by starting python and executing:
No, please follow the instructions [[Knowledge_Base#How_do_I_apply_for_an_account.3F|above]].
+
  
=== OK, I've seen and heard the word "web portal" enough, what is it anyway? ===
+
<source lang="bash">
A web portal is a web site that offers online services. Usually a web portal has a database at the backend, in which people can store and access personal information, but may involve other software services like this wiki. At SHARCNET, registered users can login to the web portal, manage their profiles, submit and review programming and performance related problems, look-up solutions to problems, contribute to our wiki, and assess their SHARCNET usage, amongst other things.
+
import pycuda
 +
</source>
  
=== My supervisor forgot all about his/her username/CCRI, so my application can't go through, what should I do? ===
+
If no errors are reported, everything worked and the package is ready for use.
Please have them send an E-mail to [mailto:help@sharcnet.ca help@sharcnet.ca] and we will re-inform them of their login credentials.
+
  
=== My supervisor does not use SHARCNET, why is my supervisor asked to have an account anyway? ===
+
8Add the lines:
Your supervisor's account ID is used to identify which group your account belongs toWe account for all usage and provide default at the group level.
+
  
=== Is there any charge for using SHARCNET? ===
+
<source lang="bash">
SHARCNET is free for all academic research. If you are working outside of academia we recommend you read our <i>Commercial Access Policy</i> which can be found in the SHARCNET web portal [https://www.sharcnet.ca/my/systems/policies here].
+
module unload intel
 +
module unload openmpi
 +
module load gcc/4.8.2
 +
module load openmpi/gcc/1.8.1
 +
module load python/gcc/2.7.8
 +
export PYTHONPATH=~/python_packages/lib/python/:$PYTHONPATH
 +
</source>
  
=== I forgot my password ===
+
to your ~/.bashrc file so that this variable is set automatically for you on every login.
You can reset your password [http://www.sharcnet.ca/my/security/forgot here], or by clicking the "Forget password" link after trying to sign-in.
+
  
=== I forgot my username ===
+
9. Test PyCUDA on a development node which has a GPU (the login node does not have one so PyCUDA tests will produce an error). To do this, execute on monk login node:
If you forget your username, please send an E-mail to [mailto:help@sharcnet.ca help@sharcnet.ca]. Your username for the web portal and cluster account are the same.
+
  
=== My account has been disabled (so i cannot login). What should I do ? ===
+
<source lang="bash">
 +
ssh mon54
 +
</source>
  
At present all academic SHARCNET accounts are automatically enabled/disabled based on the status of your corresponding Compute Canada roles. If your SHARCNET account is disabled it was most likely due to your Compute Canada account becoming expired as a result of not completing the Compute Canada account renewal / reporting process.  You should have been sent an email from Compute Canada indicating why your account was deactivated.
+
Then go to the directory where you put the PyCuda source code, and execute:
  
To renew your account (you may do this even after your account is expired),  [https://ccdb.computecanada.ca/account_renewal log into the CCDB and complete the reporting process].  Once your renewal is approved your SHARCNET account will be automatically reactivated (note that once requested, renewal may take up to 3-4 business days as a local account administrator must verify your reporting information).
+
<source lang="bash">
 +
python test/test_driver.py
 +
</source>
  
If you have questions concerning your account please email [mailto:help@sharcnet.ca help@sharcnet.ca].
+
Gives error:
  
=== How do I change the email address associated with my account? ===
+
[ppomorsk@mon241:~/supported_sharcnet_packages/pycuda/pycuda-2014.1/test] python test_driver.py
 +
Traceback (most recent call last):
 +
  File "test_driver.py", line 4, in <module>
 +
    from pycuda.tools import mark_cuda_test
 +
  File "/home/ppomorsk/python_packages/lib/python/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/tools.py", line 30, in <module>
 +
    import pycuda.driver as cuda
 +
  File "/home/ppomorsk/python_packages/lib/python/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/driver.py", line 2, in <module>
 +
    from pycuda._driver import *  # noqa
 +
ImportError: /home/ppomorsk/python_packages/lib/python/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/_driver.so: undefined symbol: cuStreamAttachMemAsync
  
If you wish to use a new email address you have to update your [https://ccdb.computecanada.ca/email Contact Information] at the Compute Canada Database.  Contact information is now updated at SHARCNET automatically based on what you have indicated to Compute Canada.
+
ldd output
  
=== I no longer want my SHARCNET account ===
+
[ppomorsk@mon54:~/supported_sharcnet_packages/pycuda/pycuda-2014.1/test] ldd /home/ppomorsk/python_packages/lib/python/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/_driver.so
If you would like to cease using SHARCNET (including access to all systems and list email) email [mailto:help@sharcnet.ca help@sharcnet.ca]. Please let us know if you'd like to disable your corresponding Compute Canada role (resulting in all it's associated Compute Canada consortia accounts being disabled as well) or if you'd just like to disable your SHARCNET account independent of your other consortia accounts.
+
  
You should only request this if you want your account disabled *now* - if you do not complete the annual renewal process at Compute Canada your account will eventually be deactivated automatically.
+
linux-vdso.so.1 =>  (0x00007fffac5c1000)
  
The [https://www.sharcnet.ca/my/systems/aup Acceptable Use Policy], in particular pt. 36, outlines our policy in the event that an account is disabled.
+
libcuda.so.1 => /usr/lib64/libcuda.so.1 (0x00002b7dbda9e000)
  
You may have your account re-enabled by emailing [mailto:help@sharcnet.ca help@sharcnet.ca].
+
libcurand.so.6.0 => /opt/sharcnet/cuda/6.0.37/toolkit/lib64/libcurand.so.6.0 (0x00002b7dbea01000)
 +
 
 +
libstdc++.so.6 => /opt/sharcnet/gcc/4.8.2/lib64/libstdc++.so.6 (0x00002b7dc3f08000)
 +
 
 +
libm.so.6 => /lib64/libm.so.6 (0x00002b7dc4211000)
 +
 +
libgcc_s.so.1 => /opt/sharcnet/gcc/4.8.2/lib64/libgcc_s.so.1 (0x00002b7dc4496000)
 +
 +
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b7dc46ac000)
 +
 +
libc.so.6 => /lib64/libc.so.6 (0x00002b7dc48c9000)
 +
 +
libz.so.1 => /lib64/libz.so.1 (0x00002b7dc4c5e000)
 +
 +
libdl.so.2 => /lib64/libdl.so.2 (0x00002b7dc4e74000)
 +
 +
librt.so.1 => /lib64/librt.so.1 (0x00002b7dc5078000)
 +
/lib64/ld-linux-x86-64.so.2 (0x00002b7dbd4a9000)
 +
 
 +
and the symbol does seem to exist
 +
 
 +
[ppomorsk@mon54:/usr/lib64] readelf -Ws libcuda.so.331.89 | grep cuStreamAttachMemAsync
 +
    43: 0000000000139890  538 FUNC    GLOBAL DEFAULT  10 cuStreamAttachMemAsync
 +
 
 +
 
 +
try
 +
 
 +
python configure.py --cuda-root=/opt/sharcnet/cuda/6.0.37/toolkit --cudadrv-lib-dir=/usr/lib64
 +
If everything is working properly, the output should look like this:
 +
 
 +
http://pycuda.2962900.n2.nabble.com/PyCUDA-undefined-symbol-cuMemAllocPitch-v2-td7571641.html
 +
 
 +
"cudart is the run-time interface, which is used by 'conventional' CUDA C
 +
code. (cudaMemcpy) PyCUDA uses the driver interface. (cuMemcpy) "
 +
 
 +
"mismatch between cuda.h and driver" ??
 +
try older CUDA modules?
 +
 
 +
 
 +
python configure.py --cuda-root=/opt/sharcnet/cuda/5.5.22/toolkit --cudadrv-lib-dir=/usr/lib64
 +
 
 +
with cuda/5.5.22 loaded
 +
even basic cuda test program fails with
 +
 
 +
FATAL: Error inserting nvidia (/lib/modules/2.6.32-431.3.1.el6.x86_64/kernel/drivers/video/nvidia.ko): No such device
 +
 
 +
 
 +
--
 +
 
 +
runpaths problem
 +
 
 +
_driver.so has an RPATH, but none of the members contain libcuda.so.  so it was build wrong, in that it doesn't correctly encode its actual dependency.
 +
 
 +
[ppomorsk@mon241:~/supported_sharcnet_packages/pycuda/pycuda-2014.1/test] objdump -x /home/ppomorsk/python_packages/lib/python/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/_driver.so | grep RPATH
 +
  RPATH                /opt/sharcnet/python/2.7.8/gcc/lib:/opt/sharcnet/gcc/4.8.2/lib64:/opt/sharcnet/cuda/6.0.37/cula/lib64:/opt/sharcnet/cuda/6.0.37/toolkit/lib64:/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64:/opt/sharcnet/mkl/10.3.9/lib/intel64
 +
 
 +
Problem with python itself??
 +
python/gcc/2.7.8 module has theano, which is GPU , so there might be some hidden dependency.
 +
 
 +
Anyway, with theano python/gcc/2.7.8 ought to have an explicit CUDA dependency.
 +
 
 +
 
 +
<source lang="bash">
 +
 
 +
[ppomorsk@mon54:~/pycuda] python test/test_driver.py
 +
============================= test session starts ==============================
 +
platform linux2 -- Python 2.6.6 -- pytest-2.3.4
 +
collected 21 items
 +
 
 +
test_driver.py .....................
 +
 
 +
========================== 21 passed in 61.39 seconds ==========================
 +
</source>
 +
 
 +
 
 +
10.  Try the example programs provided with the source code, found in the ''examples'' subdirectory of your pycuda source directory:
 +
 
 +
<source lang="bash">
 +
python examples/dump_properties.py
 +
python examples/hello_gpu.py
 +
</source>
 +
 
 +
==Sample PyCUDA code==
 +
This is code from the '''hello_gpu.py''' example program. It multiplies two vectors elementwise on the GPU, and then verifies the result with a standard calculation on the CPU.
 +
 
 +
<source lang="python">
 +
 
 +
import pycuda.driver as drv
 +
import pycuda.tools
 +
import pycuda.autoinit
 +
import numpy
 +
import numpy.linalg as la
 +
from pycuda.compiler import SourceModule
 +
 
 +
mod = SourceModule("""
 +
__global__ void multiply_them(float *dest, float *a, float *b)
 +
{
 +
  const int i = threadIdx.x;
 +
  dest[i] = a[i] * b[i];
 +
}
 +
""")
 +
 
 +
multiply_them = mod.get_function("multiply_them")
 +
 
 +
a = numpy.random.randn(400).astype(numpy.float32)
 +
b = numpy.random.randn(400).astype(numpy.float32)
 +
 
 +
dest = numpy.zeros_like(a)
 +
multiply_them(
 +
        drv.Out(dest), drv.In(a), drv.In(b),
 +
        block=(400,1,1))
 +
 
 +
print dest-a*b
 +
</source>
 +
 
 +
[[Category:Software packages]]
 +
 
 +
 
 +
 
 +
<hr>
 +
List of colors: [https://meta.wikimedia.org/wiki/Wiki_color_formatting_help Wiki_color_formatting_help]
 +
 
 +
Simplest table
 +
 
 +
{|
 +
|AA || BB || CC
 +
|-
 +
|DD || EE || FF
 +
|}
 +
 
 +
Table with padding
 +
 
 +
{| cellpadding=5
 +
|AA || BB || CC
 +
|-
 +
|DD || EE || FF
 +
|}
 +
 
 +
Table with border
 +
 
 +
{| cellpadding=5 style="border:1px solid #BBB"
 +
|- bgcolor="#fafeff"
 +
|AA || CC || EE
 +
|- bgcolor="#fafeff"
 +
|BB || DD || FF
 +
|}
 +
 
 +
 
 +
Notebox:
 +
 
 +
{| cellpadding=5 style="border:4px solid #4682B4"
 +
|- bgcolor="#E0FFFF"
 +
| This is a notebox<br>to show border color.
 +
|}
 +
 
 +
 
 +
{{#switchtablink:Tab name|CUDA|CUDA}}
 +
<headertabs/>
 +
= Third section header =
 +
This will be always displayed under the tab view
 +
because it's below the &lt;headertabs/&gt; tag.
 +
 
 +
 
 +
=== Example ===
 +
<pre>Some text above the tab view
 +
= First section header =
 +
This will be displayed on the first tab
 +
 
 +
<nowiki>{{#switchtablink:Second section header|Click here to go to the next tab...}}</nowiki>
 +
{{#switchtablink:Tab name|Link text|Page name}}
 +
= Second section header =
 +
This will be displayed on the second tab
 +
<headertabs/>
 +
= Third section header =
 +
This will be always displayed under the tab view
 +
because it's below the &lt;headertabs/&gt; tag.
 +
</pre>

Latest revision as of 09:37, 6 June 2019

This page is will be deleted pending it's creation on the CC wiki.

The header titles get automatically converted into tab titles.



PyCUDA makes it possible to easily use CUDA inside Python code.

Documentation can be found on the package webpage.

This package is not currently installed as SHARCNET-supported software, but it's easy for users to install it on their own following instructions below. If any difficulties are encountered when following these instructions, please ask SHARCNET staff for help.

See also: PyOpenCL

SHARCNET installation instructions

Monk cluster

(These instructions were tested on Oct 22, 2014 )

1. Unload the Intel compiler module (loaded by default), so that GCC becomes the default compiler. Also, use a later python version.

module unload intel
module unload openmpi
module load gcc/4.8.2
module load openmpi/gcc/1.8.1
module load python/gcc/2.7.8

Note: openmpi module is loaded because the python module needs it (it is not actually used by PyCuda)


2. Create some directory you want to build the package in, cd into it, then get the PyCUDA source code:

git clone http://git.tiker.net/trees/pycuda.git
cd pycuda
git submodule init
git submodule update
 
wget https://pypi.python.org/packages/source/p/pycuda/pycuda-2014.1.tar.gz#md5=fdc2f59e57ab7256a7e0df0d9d943022
tar xfz pycuda-2014.1.tar.gz
cd pycuda-2014.1

3. At this point decide where you want the package to be installed. In this example will use a directory called python_packages in the home directory. If this directory does not yet exist, make it with:

mkdir -p ~/python_packages/lib/python/

Doing it this way creates the required subdirectories as well.

4. Edit file Makefile.in to add --home flag pointing to the directory you created to the setup install line, so that it reads:

${PYTHON_EXE} setup.py install --home=~/python_packages

5.You now need to update the PYTHONPATH variable to point to the library directory:

export PYTHONPATH=~/python_packages/lib/python/:$PYTHONPATH

6. Configure and compile, providing a path to the CUDA files on monk:

python configure.py --cuda-root=/opt/sharcnet/cuda/6.0.37/toolkit
make install

7. Do the first test of the installation to make sure the pycuda module can be imported, by starting python and executing:

import pycuda

If no errors are reported, everything worked and the package is ready for use.

8. Add the lines:

module unload intel
module unload openmpi
module load gcc/4.8.2
module load openmpi/gcc/1.8.1
module load python/gcc/2.7.8
export PYTHONPATH=~/python_packages/lib/python/:$PYTHONPATH

to your ~/.bashrc file so that this variable is set automatically for you on every login.

9. Test PyCUDA on a development node which has a GPU (the login node does not have one so PyCUDA tests will produce an error). To do this, execute on monk login node:

ssh mon54

Then go to the directory where you put the PyCuda source code, and execute:

python test/test_driver.py

Gives error:

[ppomorsk@mon241:~/supported_sharcnet_packages/pycuda/pycuda-2014.1/test] python test_driver.py Traceback (most recent call last):

 File "test_driver.py", line 4, in <module>
   from pycuda.tools import mark_cuda_test
 File "/home/ppomorsk/python_packages/lib/python/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/tools.py", line 30, in <module>
   import pycuda.driver as cuda
 File "/home/ppomorsk/python_packages/lib/python/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/driver.py", line 2, in <module>
   from pycuda._driver import *  # noqa
ImportError: /home/ppomorsk/python_packages/lib/python/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/_driver.so: undefined symbol: cuStreamAttachMemAsync

ldd output

[ppomorsk@mon54:~/supported_sharcnet_packages/pycuda/pycuda-2014.1/test] ldd /home/ppomorsk/python_packages/lib/python/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/_driver.so

linux-vdso.so.1 => (0x00007fffac5c1000)

libcuda.so.1 => /usr/lib64/libcuda.so.1 (0x00002b7dbda9e000)

libcurand.so.6.0 => /opt/sharcnet/cuda/6.0.37/toolkit/lib64/libcurand.so.6.0 (0x00002b7dbea01000)

libstdc++.so.6 => /opt/sharcnet/gcc/4.8.2/lib64/libstdc++.so.6 (0x00002b7dc3f08000)

libm.so.6 => /lib64/libm.so.6 (0x00002b7dc4211000)

libgcc_s.so.1 => /opt/sharcnet/gcc/4.8.2/lib64/libgcc_s.so.1 (0x00002b7dc4496000)

libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b7dc46ac000)

libc.so.6 => /lib64/libc.so.6 (0x00002b7dc48c9000)

libz.so.1 => /lib64/libz.so.1 (0x00002b7dc4c5e000)

libdl.so.2 => /lib64/libdl.so.2 (0x00002b7dc4e74000)

librt.so.1 => /lib64/librt.so.1 (0x00002b7dc5078000) /lib64/ld-linux-x86-64.so.2 (0x00002b7dbd4a9000)

and the symbol does seem to exist

[ppomorsk@mon54:/usr/lib64] readelf -Ws libcuda.so.331.89 | grep cuStreamAttachMemAsync
   43: 0000000000139890   538 FUNC    GLOBAL DEFAULT   10 cuStreamAttachMemAsync


try

python configure.py --cuda-root=/opt/sharcnet/cuda/6.0.37/toolkit --cudadrv-lib-dir=/usr/lib64

If everything is working properly, the output should look like this:

http://pycuda.2962900.n2.nabble.com/PyCUDA-undefined-symbol-cuMemAllocPitch-v2-td7571641.html

"cudart is the run-time interface, which is used by 'conventional' CUDA C code. (cudaMemcpy) PyCUDA uses the driver interface. (cuMemcpy) "

"mismatch between cuda.h and driver" ?? try older CUDA modules?


python configure.py --cuda-root=/opt/sharcnet/cuda/5.5.22/toolkit --cudadrv-lib-dir=/usr/lib64

with cuda/5.5.22 loaded even basic cuda test program fails with

FATAL: Error inserting nvidia (/lib/modules/2.6.32-431.3.1.el6.x86_64/kernel/drivers/video/nvidia.ko): No such device


--

runpaths problem

_driver.so has an RPATH, but none of the members contain libcuda.so.  so it was build wrong, in that it doesn't correctly encode its actual dependency.

[ppomorsk@mon241:~/supported_sharcnet_packages/pycuda/pycuda-2014.1/test] objdump -x /home/ppomorsk/python_packages/lib/python/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/_driver.so | grep RPATH

 RPATH                /opt/sharcnet/python/2.7.8/gcc/lib:/opt/sharcnet/gcc/4.8.2/lib64:/opt/sharcnet/cuda/6.0.37/cula/lib64:/opt/sharcnet/cuda/6.0.37/toolkit/lib64:/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64:/opt/sharcnet/mkl/10.3.9/lib/intel64

Problem with python itself?? python/gcc/2.7.8 module has theano, which is GPU , so there might be some hidden dependency.

Anyway, with theano python/gcc/2.7.8 ought to have an explicit CUDA dependency.


[ppomorsk@mon54:~/pycuda] python test/test_driver.py 
============================= test session starts ==============================
platform linux2 -- Python 2.6.6 -- pytest-2.3.4
collected 21 items 
 
test_driver.py .....................
 
========================== 21 passed in 61.39 seconds ==========================


10. Try the example programs provided with the source code, found in the examples subdirectory of your pycuda source directory:

python examples/dump_properties.py
python examples/hello_gpu.py

Sample PyCUDA code

This is code from the hello_gpu.py example program. It multiplies two vectors elementwise on the GPU, and then verifies the result with a standard calculation on the CPU.

import pycuda.driver as drv
import pycuda.tools
import pycuda.autoinit
import numpy
import numpy.linalg as la
from pycuda.compiler import SourceModule
 
mod = SourceModule("""
__global__ void multiply_them(float *dest, float *a, float *b)
{
  const int i = threadIdx.x;
  dest[i] = a[i] * b[i];
}
""")
 
multiply_them = mod.get_function("multiply_them")
 
a = numpy.random.randn(400).astype(numpy.float32)
b = numpy.random.randn(400).astype(numpy.float32)
 
dest = numpy.zeros_like(a)
multiply_them(
        drv.Out(dest), drv.In(a), drv.In(b),
        block=(400,1,1))
 
print dest-a*b



List of colors: Wiki_color_formatting_help

Simplest table

AA BB CC
DD EE FF

Table with padding

AA BB CC
DD EE FF

Table with border

AA CC EE
BB DD FF


Notebox:

This is a notebox
to show border color.


CUDA

Third section header

This will be always displayed under the tab view because it's below the <headertabs/> tag.


Example

Some text above the tab view
= First section header =
This will be displayed on the first tab

{{#switchtablink:Second section header|Click here to go to the next tab...}}
{{#switchtablink:Tab name|Link text|Page name}}
= Second section header =
This will be displayed on the second tab
<headertabs/>
= Third section header =
This will be always displayed under the tab view
because it's below the <headertabs/> tag.