Outils pour utilisateurs

Outils du site


cupy_vs_numpy

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
cupy_vs_numpy [2020/04/14 14:27] – [Exemple avec l'intelligence du sémaphore] sergecupy_vs_numpy [2020/09/06 13:51] (Version actuelle) – [Comment adapter un fichier numpy en cupy] serge
Ligne 4: Ligne 4:
 </WRAP> </WRAP>
  
 +[[https://developer.download.nvidia.com/video/gputechconf/gtc/2019/presentation/s9738-using-gpu-power-for-numpy-syntax-calculations.pdf|s9738-using-gpu-power-for-numpy-syntax-calculations.pdf]] sur developer.download.nvidia.com
 +
 +[[https://docs-cupy.chainer.org/en/stable/reference/difference.html|Difference between CuPy and NumPy — CuPy 7.8.0 documentation]] sur docs-cupy.chainer.org
  
 ===== Ressources ===== ===== Ressources =====
   * **Un pdf de présentation de [[https://developer.download.nvidia.com/video/gputechconf/gtc/2019/presentation/s9738-using-gpu-power-for-numpy-syntax-calculations.pdf|Nvidia]]**   * **Un pdf de présentation de [[https://developer.download.nvidia.com/video/gputechconf/gtc/2019/presentation/s9738-using-gpu-power-for-numpy-syntax-calculations.pdf|Nvidia]]**
  
-{{:media_10:using-gpu-power-for-numpy-syntax-calculations-10.png?600|}} +{{:media_10:using-gpu-power-for-numpy-syntax-calculations-10.png?400|}} 
-{{:media_10:using-gpu-power-for-numpy-syntax-calculations-16.png?600|}} +{{:media_10:using-gpu-power-for-numpy-syntax-calculations-16.png?400|}} 
-{{:media_10:using-gpu-power-for-numpy-syntax-calculations-11.png?600|}}+{{:media_10:using-gpu-power-for-numpy-syntax-calculations-11.png?400|}}
   * **[[https://cupy.chainer.org/|cupy.chainer.org]]**   * **[[https://cupy.chainer.org/|cupy.chainer.org]]**
   * **[[https://docs-cupy.chainer.org/en/stable/|Read the Docs de CuPy]]**   * **[[https://docs-cupy.chainer.org/en/stable/|Read the Docs de CuPy]]**
Ligne 25: Ligne 28:
   * **scipy**   * **scipy**
   * **opencv**   * **opencv**
 +=====Installation=====
 +  sudo pip3 install cupy-cuda102
 +
 =====Comment adapter un fichier numpy en cupy===== =====Comment adapter un fichier numpy en cupy=====
 [[https://docs-cupy.chainer.org/en/stable/reference/difference.html|docs-cupy.chainer.org: Difference between CuPy and NumPy]] [[https://docs-cupy.chainer.org/en/stable/reference/difference.html|docs-cupy.chainer.org: Difference between CuPy and NumPy]]
Ligne 32: Ligne 38:
   * Exemple avec: [[l_intelligence_du_semaphore|L'intelligence du sémaphore]]   * Exemple avec: [[l_intelligence_du_semaphore|L'intelligence du sémaphore]]
   * [[https://github.com/sergeLabo/semaphore_cupy|Les sources sur GitHub: semaphore_cupy]]   * [[https://github.com/sergeLabo/semaphore_cupy|Les sources sur GitHub: semaphore_cupy]]
 +
 +====Numpy====
 +Avec le script semaphore_ia.py
 +<code>
 +AMD FX(tm)-8320 Eight-Core Processor
 +
 +Calcul avec numpy ... numpy ... numpy ... numpy ... 
 +Training: Shot 60000 Lettre 60000; Testing: Shot 10000 Lettre 10000
 +Training...
 +type(weight_list :) <class 'list'> 
 +len(weight_list) = 3 
 +    0 100 
 +    1 100 
 +    2 27
 +weights.npy enregistré
 +Testing...
 +Learningrate: 0.023 Résultat 87.4
 +Calcul en: 139.8 s
 +</code>
 +
 +====Cupy====
 +Avec le script cupy_ia.py
 +<code>
 +cupy 7.3
 +Successfully installed cupy-7.3.0 fastrlock-0.4
 +Nvidia 1060 GTX
 +
 +Calcul avec cupy ... cupy ... cupy ... cupy ... 
 +Training: Shot 60000 Lettre 60000; Testing: Shot 10000 Lettre 10000
 +Training...
 +type(weight_list :) <class 'list'> 
 +len(weight_list) = 3 
 +    0 100 <class 'cupy.core.core.ndarray'> 
 +    1 100 <class 'cupy.core.core.ndarray'> 
 +    2 27 <class 'cupy.core.core.ndarray'>
 +weights_cupy.npy enregistré
 +Testing...
 +Learningrate: 0.023 Résultat 89.9
 +Calcul en: 91.7 s
 +</code>
 +
 +**Soit un gain de 34% avec cupy**
 +
 +Il faut vérifier que toutes les datas sont bien chargées dans la RAM GPU: cupy.array 
 +[[https://docs-cupy.chainer.org/en/stable/tutorial/basic.html|docs-cupy.chainer.org: basic]]
 +===== OpenCV =====
 +https://docs-cupy.chainer.org/en/stable/reference/ndimage.html#module-cupyx.scipy.ndimage
 +
  
  
-{{tag>python sb}}+{{tag> ia python sb }}
cupy_vs_numpy.1586874450.txt.gz · Dernière modification : 2020/04/14 14:27 de serge