Theano/Theano — pull request #1975 by rahul003 (2014-07-17 16:31:36+00:00)
Title: fix crash of profiling atexit when it clashes with pycuda atexit handler

This was the error earlier when using profiling. Arnaud made the following changes which worked.

```
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/u/lisa/local/install_package.fc14_v3/Canopy1.4/appdata/canopy-1.4.0.1938.rh5-x86_64/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/u/huilgolr/Theano/theano/compile/profiling.py", line 65, in _atexit_print_fn
n_apply_to_print=config.profiling.n_apply)
File "/u/huilgolr/Theano/theano/compile/profiling.py", line 842, in summary
self.summary_nodes(file, n_apply_to_print)
File "/u/huilgolr/Theano/theano/compile/profiling.py", line 550, in summary_nodes
str(a)[:maxlen])
File "/u/huilgolr/Theano/theano/gof/graph.py", line 165, in __str__
return op_as_string(self.inputs, self)
File "/u/huilgolr/Theano/theano/gof/graph.py", line 937, in op_as_string
strs = as_string(i, op.inputs, leaf_formatter, node_formatter)
File "/u/huilgolr/Theano/theano/gof/graph.py", line 1013, in as_string
return [describe(output) for output in o]
File "/u/huilgolr/Theano/theano/gof/graph.py", line 1011, in describe
return leaf_formatter(r)
File "/u/huilgolr/Theano/theano/sandbox/cuda/var.py", line 52, in __str__
return "CudaNdarrayConstant{"+str(numpy.asarray(self.data))+"}"
File "/Tmp/lisa/os_v3/canopy/lib/python2.7/site-packages/numpy/core/numeric.py", line 460, in asarray
return array(a, dtype, copy=False, order=order)
RuntimeError: error copying data to host
Error in sys.exitfunc:
Traceback (most recent call last):
File "/u/lisa/local/install_package.fc14_v3/Canopy1.4/appdata/canopy-1.4.0.1938.rh5-x86_64/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/u/huilgolr/Theano/theano/compile/profiling.py", line 65, in _atexit_print_fn
n_apply_to_print=config.profiling.n_apply)
File "/u/huilgolr/Theano/theano/compile/profiling.py", line 842, in summary
self.summary_nodes(file, n_apply_to_print)
File "/u/huilgolr/Theano/theano/compile/profiling.py", line 550, in summary_nodes
str(a)[:maxlen])
File "/u/huilgolr/Theano/theano/gof/graph.py", line 165, in __str__
return op_as_string(self.inputs, self)
File "/u/huilgolr/Theano/theano/gof/graph.py", line 937, in op_as_string
strs = as_string(i, op.inputs, leaf_formatter, node_formatter)
File "/u/huilgolr/Theano/theano/gof/graph.py", line 1013, in as_string
return [describe(output) for output in o]
File "/u/huilgolr/Theano/theano/gof/graph.py", line 1011, in describe
return leaf_formatter(r)
File "/u/huilgolr/Theano/theano/sandbox/cuda/var.py", line 52, in __str__
return "CudaNdarrayConstant{"+str(numpy.asarray(self.data))+"}"
File "/Tmp/lisa/os_v3/canopy/lib/python2.7/site-packages/numpy/core/numeric.py", line 460, in asarray
return array(a, dtype, copy=False, order=order)
RuntimeError: error copying data to host
```