10.06.2017       Выпуск 181 (05.06.2017 - 11.06.2017)       Интересные проекты, инструменты, библиотеки

OpenCLGA - запускаем генетический алгоритм на OpenCL

Читать>>



Экспериментальная функция:

Ниже вы видите текст статьи по ссылке. По нему можно быстро понять ссылка достойна прочтения или нет

Просим обратить внимание, что текст по ссылке и здесь может не совпадать.

README.rst

OpenCLGA

OpenCLGA is a python library for running genetic algorithm among Open CL devices, like GPU, CPU, DSP, etc. In the best case, you can run your GA parallelly at all of your Open CL devices which give you the maximum computing power of your machine. In the worse case, which you only have CPU, you still can run the code at parallel CPU mode.

We had implemented OpenCLGA at ocl_ga.py which encapsulate GA follow (population, crossover, mutation, fitness calculation). User could solve their problem by providing the fitness calculation function and run the code.

Please note that OpenCLGA is implemented at Python 3.5 or above. It should work at Python 2.x but it is not guaranteed.

Demo Video

Taiwan Travel example: https://youtu.be/4pqmuV8RkMg

Prerequisite: install PYOPENCL

Option A. Please refer to https://wiki.tiker.net/PyOpenCL to find your OS or

Option B. Install by ourself

Run OpenCLGA examples

  1. Enter virtual env (optional):
  • For Windows with MinGW environment.

    $> source <NameOfEnv>/Scripts/activate
    
  • For Linux/Mac OS X environment.

    $> source ./NameOfEnv/bin/activate
    
  1. Download the code from Github or git clone the repository via the following command.

    <NameOfEnv>$> git clone https://github.com/PyOCL/OpenCLGA.git
    
  2. Execute the code.

    <NameOfEnv>$> pip3 install git+git://github.com/PyOCL/OpenCLGA.git
    <NameOfEnv>$> unzip OpenCLGA-master.zip
    <NameOfEnv>$> cd OpenCLGA-master
    <NameOfEnv>$> python3 examples/tsp/simple_tsp.py
    

NOTE : In external process mode, if "no device" exception happen during create_some_context(), Please set PYOPENCL_CTX=N (N is the device number you want by default) at first.

NOTE : Since we didn't publish this project to pipa. We need to install this project with source, `pip3 install .`.



Лучшая Python рассылка

Нас поддерживает


Python Software Foundation



Разместим вашу рекламу

Пиши: mail@pythondigest.ru

Нашли опечатку?

Выделите фрагмент и отправьте нажатием Ctrl+Enter.

Система Orphus