{
  "id": 4505,
  "title": "How to tell if Theano/Pylearn2 is actually using the GPU?",
  "url": "/competitions/challenges-in-representation-learning-the-black-box-learning-challenge/discussion/4505",
  "author_name": "",
  "post_date": "2013-05-05T16:25:55.547Z",
  "votes": null,
  "comment_count": 4,
  "views": 6007,
  "content": "<p>I'm trying to get the mlp.yaml example running using the gpu on a win64 setup. It does run, and claims to be using the gpu, but it just doesn't seem to actually be using it. &nbsp;I'm getting conflicting evidence. &nbsp;For example, the first line of the output is\r\n &quot;Using gpu device 0: GeForce GTX 470&quot;. &nbsp;When I run the program, I see my used gpu memory increase (using GPU-Z). &nbsp;I'm forcing the use of the gpu using the following .theanorc.txt file:</p>\r\n<pre>[global]<br>device=gpu0<br>force_device=True<br>openmp=False<br><br>[blas]<br>ldflags=</pre>\r\n<p>However, when I run I see a 0% gpu load in GPU-Z (and my cpu usage is very high). &nbsp;When I run it in NVIDIA's visual profiler, I don't see any kernels getting launched. &nbsp;So, as best I can tell, it's seeing/initializing the gpu and allocating memory, but not\r\n actually running anything on it. &nbsp;Any ideas what's happening here?</p>",
  "messages": [
    {
      "id": "23916",
      "postDate": "05/05/2013 16:25:55",
      "content": "<p>I'm trying to get the mlp.yaml example running using the gpu on a win64 setup. It does run, and claims to be using the gpu, but it just doesn't seem to actually be using it. &nbsp;I'm getting conflicting evidence. &nbsp;For example, the first line of the output is\r\n &quot;Using gpu device 0: GeForce GTX 470&quot;. &nbsp;When I run the program, I see my used gpu memory increase (using GPU-Z). &nbsp;I'm forcing the use of the gpu using the following .theanorc.txt file:</p>\r\n<pre>[global]<br>device=gpu0<br>force_device=True<br>openmp=False<br><br>[blas]<br>ldflags=</pre>\r\n<p>However, when I run I see a 0% gpu load in GPU-Z (and my cpu usage is very high). &nbsp;When I run it in NVIDIA's visual profiler, I don't see any kernels getting launched. &nbsp;So, as best I can tell, it's seeing/initializing the gpu and allocating memory, but not\r\n actually running anything on it. &nbsp;Any ideas what's happening here?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23918",
      "postDate": "05/05/2013 16:35:34",
      "content": "<p>When theano says it's using the GPU, that means it will put everything on the GPU that it is able to. Theano is currently able to put 32 bit variables on the GPU.</p>\r\n<p>When pylearn2 makes a floating point variable, it almost always makes it with the default number of bits specified by theano's configuration variable &quot;floatX&quot;. By default, floatX is float64 so all of your variables are 64 bit and can't go on gpu.</p>\r\n<p>I put:</p>\r\n<p>[global]</p>\r\n<p>floatX=float32</p>\r\n<p>in my ~/.theanorc file so theano just always uses 32 bit variables and I don't have to worry about it.</p>\r\n<p>You can also set the environment variable THEANO_FLAGS=&quot;floatX=float32&quot; if you prefer to do it that way.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23919",
      "postDate": "05/05/2013 16:56:25",
      "content": "<p>Thanks Ian! &nbsp;That was exactly the problem, it's working for me now.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23922",
      "postDate": "05/05/2013 21:29:16",
      "content": "<p>[quote=Daniel;23919]</p>\r\n<p>Thanks Ian! &nbsp;That was exactly the problem, it's working for me now.</p>\r\n<p>[/quote]</p>\r\n<p>Hi, Daniel</p>\r\n<p>I'm trying configure my GPU with Theano in W7 64. I've installed VS express 10.0 and when compiling in Theano&nbsp;<span style=\"line-height:1.4em\">I obtain this error:</span></p>\r\n<pre class=\"x_default x_prettyprint x_prettyprinted\"><code><span class=\"x_pln\">nvcc fatal </span><span class=\"x_pun\">:</span><span class=\"x_typ\">Visual</span><span class=\"x_typ\">Studio</span><span class=\"x_pln\"> configuration file </span><span class=\"x_str\">'(null)'</span><span class=\"x_pln\"> could </span><span class=\"x_kwd\">not</span><span class=\"x_pln\">&nbsp;</span></code></pre>\r\n<pre class=\"x_default x_prettyprint x_prettyprinted\"><code><span class=\"x_pln\">be found </span><span class=\"x_kwd\">for</span><span class=\"x_pln\"> installation at </span><span class=\"x_str\">'C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/../..</span></code></pre>\r\n<pre class=\"x_default x_prettyprint x_prettyprinted\"><code><span class=\"x_str\"><br></span></code></pre>\r\n<p>Any tip?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23926",
      "postDate": "05/06/2013 01:52:20",
      "content": "<p>Hi Jose,</p>\r\n<p>&nbsp; &nbsp; I haven't run into that error myself. &nbsp;While I am developing in the Visual Studio IDE, I'm only using it as an editor with the PTVS plugin. &nbsp;To compile Theano functions I'm using the mingw-w64 toolchain, I'm not using msvc at all.</p>\r\n<p>- Dan</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 23918,
      "author_name": "iangoodfellow",
      "author_url": "",
      "post_date": "05/05/2013 16:35:34",
      "content": "<p>When theano says it's using the GPU, that means it will put everything on the GPU that it is able to. Theano is currently able to put 32 bit variables on the GPU.</p>\r\n<p>When pylearn2 makes a floating point variable, it almost always makes it with the default number of bits specified by theano's configuration variable &quot;floatX&quot;. By default, floatX is float64 so all of your variables are 64 bit and can't go on gpu.</p>\r\n<p>I put:</p>\r\n<p>[global]</p>\r\n<p>floatX=float32</p>\r\n<p>in my ~/.theanorc file so theano just always uses 32 bit variables and I don't have to worry about it.</p>\r\n<p>You can also set the environment variable THEANO_FLAGS=&quot;floatX=float32&quot; if you prefer to do it that way.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 23919,
      "author_name": "dpineo",
      "author_url": "",
      "post_date": "05/05/2013 16:56:25",
      "content": "<p>Thanks Ian! &nbsp;That was exactly the problem, it's working for me now.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 23922,
      "author_name": "blindape",
      "author_url": "",
      "post_date": "05/05/2013 21:29:16",
      "content": "<p>[quote=Daniel;23919]</p>\r\n<p>Thanks Ian! &nbsp;That was exactly the problem, it's working for me now.</p>\r\n<p>[/quote]</p>\r\n<p>Hi, Daniel</p>\r\n<p>I'm trying configure my GPU with Theano in W7 64. I've installed VS express 10.0 and when compiling in Theano&nbsp;<span style=\"line-height:1.4em\">I obtain this error:</span></p>\r\n<pre class=\"x_default x_prettyprint x_prettyprinted\"><code><span class=\"x_pln\">nvcc fatal </span><span class=\"x_pun\">:</span><span class=\"x_typ\">Visual</span><span class=\"x_typ\">Studio</span><span class=\"x_pln\"> configuration file </span><span class=\"x_str\">'(null)'</span><span class=\"x_pln\"> could </span><span class=\"x_kwd\">not</span><span class=\"x_pln\">&nbsp;</span></code></pre>\r\n<pre class=\"x_default x_prettyprint x_prettyprinted\"><code><span class=\"x_pln\">be found </span><span class=\"x_kwd\">for</span><span class=\"x_pln\"> installation at </span><span class=\"x_str\">'C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/../..</span></code></pre>\r\n<pre class=\"x_default x_prettyprint x_prettyprinted\"><code><span class=\"x_str\"><br></span></code></pre>\r\n<p>Any tip?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 23926,
      "author_name": "dpineo",
      "author_url": "",
      "post_date": "05/06/2013 01:52:20",
      "content": "<p>Hi Jose,</p>\r\n<p>&nbsp; &nbsp; I haven't run into that error myself. &nbsp;While I am developing in the Visual Studio IDE, I'm only using it as an editor with the PTVS plugin. &nbsp;To compile Theano functions I'm using the mingw-w64 toolchain, I'm not using msvc at all.</p>\r\n<p>- Dan</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "23916": "",
    "23918": "",
    "23919": "",
    "23922": "",
    "23926": ""
  },
  "source": "meta"
}