How to set up theano config

后端 未结 5 406
面向向阳花
面向向阳花 2020-12-29 19:12

I\'m new to Theano. Trying to set up a config file.

First of all, I notice that I have no .theanorc file:

  1. locate .theanorc - returns nothi
相关标签:
5条回答
  • 2020-12-29 19:43

    I have been having similar problems. I have NVIDIA 1070 GPU on a desktop machine with Asus Z270E motherboard and was able to import theano after setting up the .theanorc file as below. (And rebooting afterwards)

    [global]
    floatX = float32
    device = gpu
    
    [cuda]
    root = /usr/local/cuda
    [lib]
    cnmem = 1   
    
    0 讨论(0)
  • 2020-12-29 19:44

    I had a similar question and this is what helped me:

    import theano
    //...
    theano.config.floatX = 'float32' //or 'float64' whatever you want
    
    0 讨论(0)
  • 2020-12-29 19:49

    This worked for me:

    nano ~/.theanorc
    

    Then I entered:

    [global]
    floatX = float32
    device = cuda
    

    Code to check if Theano is using the GPU is on the Theano doc page.

    (I am using Ubuntu 14.04, Theano 0.9.0 (conda), NVIDIA 1080 Ti GPU).

    0 讨论(0)
  • 2020-12-29 19:51

    In Linux in terminal Home directory write:

    nano .theanorc
    

    In the file copy the following lines

    [global]
    floatX = float32
    device = gpu0
    
    [lib]
    cnmem = 1   
    

    Save it.

    When I import theano in python I was having cnmem memory problems. Seems that is because the monitor is connected to the gpu. To resolve it change cnmem to 0.8. This number below 1 is the percentage of gpu reserved for theano

    0 讨论(0)
  • 2020-12-29 19:54

    Theano does not create any configuration file by itself, but has default values for all its configuration flags. You only need such a file if you want to modify the default values.

    This can be done by creating a .theanorc file in your home directory. For example, if you want floatX to be always float32, you can do this:

    echo -e "\n[global]\nfloatX=float32\n" >> ~/.theanorc
    

    under Linux and Mac. Under windows, this can also be done. See this page for more details:

    http://deeplearning.net/software/theano/library/config.html

    0 讨论(0)
提交回复
热议问题