docs: def resources_setup():
      '''
      This function checks CUDA devices, selects some and installs resources.py
      '''
      print 'i> installing file <resources.py> into home directory if it does not exist.'
      path_current = os.path.dirname( os.path.realpath(__file__) )
      # path to the install version of resources.py.
      path_install = os.path.join(path_current, 'resources')
      # get the path to the local resources.py (on Linux machines it is in ~/.niftypet)
      path_resources = path_niftypet_local()
      print path_current
  
      # flag for the resources file if already installed (initially assumed not)
      flg_resources = False
      # does the local folder for niftypet exists? if not create one. 
      if not os.path.exists(path_resources):
          os.makedirs(path_resources)
      # is resources.py in the folder?
      if not os.path.isfile(os.path.join(path_resources,'resources.py')):
          if os.path.isfile(os.path.join(path_install,'resources.py')):
              shutil.copyfile( os.path.join(path_install,'resources.py'), os.path.join(path_resources,'resources.py') )
          else:
              print 'e> could not fine file <resources.py> to be installed!'
              raise IOError('could not find <resources.py')
      else:
          print 'i> <resources.py> should be already in the local NiftyPET folder.', path_resources
          # set the flag that the resources file is already there
          flg_resources = True
          sys.path.append(path_resources)
          try:
              import resources
          except ImportError as ie:
              print '----------------------------'
              print 'e> Import Error: NiftyPET''s resources file <resources.py> could not be imported.  It should be in ''~/.niftypet/resources.py'' but likely it does not exists.'
              print '----------------------------'
  
      # find available GPU devices, select one or more and output the compilation flags
      gpuarch = dev_setup()
  
      # return gpuarch for cmake compilation
      return gpuarch