.. oe:namespace:: OEGraphSim

.. oe:constnamespace:: OEFastFPDatabaseMemoryType

   This namespace contains memory type constants representing how
   fingerprints are stored and searched for in an
   :ref:`OEFastFPDatabase <OEGraphSim_OEFastFPDatabase>` object.

   .. seealso::

      * :ref:`OEFastFPDatabase <OEGraphSim_OEFastFPDatabase>` class

   .. oe:constant:: Default

      The default memory type is
      :oe:const:`OEGraphSim::OEFastFPDatabaseMemoryType::MemoryMapped`.

   .. oe:constant:: CUDA

      If a CUDA-enabled GPU is available, :ref:`OEFastFPDatabase <OEGraphSim_OEFastFPDatabase>`
      can take advantage of the device for similarity calculations.
      When an :ref:`OEFastFPDatabase <OEGraphSim_OEFastFPDatabase>` is initialized with the
      :oe:const:`OEGraphSim::OEFastFPDatabaseMemoryType::CUDA` type,
      similarity calculations are performed on the device. Initialization incurs a one-time load
      penalty, similar to :oe:const:`OEGraphSim::OEFastFPDatabaseMemoryType::InMemory`.

      **Requirements:**

      * :ref:`Prerequisites for OpenEye's GPU-accelerated software <graphsim_prereq_for_gpu>`
      * Fingerprint sizes of multiples of 1024 bits.

      .. note::

         At present, multi-GPU support is not available. If there are multiple CUDA 
         devices on the system, the first compatible device detected will be used.
         To enforce the use of a particular device, set the environment
         variable ``CUDA_VISIBLE_DEVICES``.

      .. note::

         If device memory limits are exceeded or a CUDA-enabled device is not detected this 
         implementation falls back to :oe:const:`OEGraphSim::OEFastFPDatabaseMemoryType::MemoryMapped`

   .. oe:constant:: InMemory

      When an :ref:`OEFastFPDatabase <OEGraphSim_OEFastFPDatabase>` is initialized with
      :oe:const:`OEGraphSim::OEFastFPDatabaseMemoryType::InMemory` type
      the fingerprints are pre-loaded into memory and the similarity
      search performed in-memory when calling the
      :oe:meth:`OEGraphSim::OEFastFPDatabase::GetSortedScores` method.

      .. hint::

         :oe:const:`OEGraphSim::OEFastFPDatabaseMemoryType::InMemory` presents
         the fastest search at the expense of load time and the search is limited by
         the size of the memory.


   .. oe:constant:: MemoryMapped

      When an :ref:`OEFastFPDatabase <OEGraphSim_OEFastFPDatabase>` is initialized with
      :oe:const:`OEGraphSim::OEFastFPDatabaseMemoryType::MemoryMapped`
      type there is no load time penalty or memory limitation but the
      search itself is slower.

   .. seealso::

      * Example code in :ref:`section_examples_summary_searchfastfp` section
