Skip to content

[Experimental] Support AMD GPU via HIP (ROCm2.7.0+)#1094

Merged
mitmul merged 24 commits intocupy:masterfrom
okuta:support-hip
Oct 1, 2019
Merged

[Experimental] Support AMD GPU via HIP (ROCm2.7.0+)#1094
mitmul merged 24 commits intocupy:masterfrom
okuta:support-hip

Conversation

@okuta
Copy link
Copy Markdown
Member

@okuta okuta commented Apr 4, 2018

I want to support AMD GPU environment via HIP.
This PR is related to #1117 .

Step 1: Install ROCm 2.7.0+

Please read this document
And, please install hipblas and rocrand.

sudo apt install hipblas hipsparse rocrand

Step 2: Set environment variables

export HCC_AMDGPU_TARGET=gfx900

export ROCM_HOME=/opt/rocm
export CUPY_INSTALL_USE_HIP=1

And, please set PATH.

export PATH=$ROCM_HOME/bin:$PATH

Step3: Install CuPy

python setup.py install

or

python setup.py develop

Feature

  • ufunc
  • simple reduction kernel with workaround
  • simple reduction kernel without workaround (This is solved by 1.9+)
  • float16
  • complex
  • hiprtc wrapper (but CuPy doesn't use it)
  • document
  • ci (Add CI configuration for ROCm #2408)

@okuta okuta added the cat:feature New features/APIs label Apr 4, 2018
@okuta okuta force-pushed the support-hip branch 2 times, most recently from 06f68ce to 65ff9cc Compare April 4, 2018 17:53
@okuta okuta changed the title Support AMD GPU via HIP [WIP] Support AMD GPU via HIP Apr 9, 2018
This was referenced Apr 9, 2018
@okuta okuta added the st:blocked-by-another-pr Blocked by another pull-request label Apr 9, 2018
@okuta okuta force-pushed the support-hip branch 5 times, most recently from 2e598b0 to 441304b Compare April 16, 2018 10:02
@okuta okuta changed the title [WIP] Support AMD GPU via HIP [WIP] Support AMD GPU via HIP (ROCm1.8.1+) Jul 1, 2018
@okuta okuta force-pushed the support-hip branch 5 times, most recently from 3ab6577 to d42d634 Compare July 8, 2018 14:57
@okuta okuta force-pushed the support-hip branch 3 times, most recently from 7804c13 to b91b6d5 Compare July 22, 2018 06:19
@okuta okuta removed the st:blocked-by-another-pr Blocked by another pull-request label Aug 27, 2018
@okuta okuta added this to the v5 milestone Sep 10, 2018
@jedwards-AMD
Copy link
Copy Markdown

I am trying to use this pull request, but I am getting the following install error when using 'python setup.py install':
,
,
,
.
running install_lib
running build_py
running build_ext
Traceback (most recent call last):
File "setup.py", line 122, in
'sdist': sdist},
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/init.py", line 140, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/install.py", line 67, in run
self.do_egg_install()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/install.py", line 109, in do_egg_install
self.run_command('bdist_egg')
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/bdist_egg.py", line 172, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/bdist_egg.py", line 158, in call_command
self.run_command(cmdname)
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/install_lib.py", line 11, in run
self.build()
File "/usr/lib/python2.7/distutils/command/install_lib.py", line 111, in build
self.run_command('build_ext')
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/git/cupy/cupy_setup_build.py", line 815, in run
check_extensions(self.extensions)
File "/home/user1/git/cupy/cupy_setup_build.py", line 619, in check_extensions
'''.format(f, required_cython_version))
RuntimeError: Missing file: cupy/core/_dtype.cpp
Please install Cythrunning install_lib
running build_py
running build_ext
Traceback (most recent call last):
File "setup.py", line 122, in
'sdist': sdist},
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/init.py", line 140, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/install.py", line 67, in run
self.do_egg_install()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/install.py", line 109, in do_egg_install
self.run_command('bdist_egg')
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/bdist_egg.py", line 172, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/bdist_egg.py", line 158, in call_command
self.run_command(cmdname)
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/install_lib.py", line 11, in run
self.build()
File "/usr/lib/python2.7/distutils/command/install_lib.py", line 111, in build
self.run_command('build_ext')
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/git/cupy/cupy_setup_build.py", line 815, in run
check_extensions(self.extensions)
File "/home/user1/git/cupy/cupy_setup_build.py", line 619, in check_extensions
'''.format(f, required_cython_version))
RuntimeError: Misrunning install_lib
running build_py
running build_ext
Traceback (most recent call last):
File "setup.py", line 122, in
'sdist': sdist},
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/init.py", line 140, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/install.py", line 67, in run
self.do_egg_install()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/install.py", line 109, in do_egg_install
self.run_command('bdist_egg')
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/bdist_egg.py", line 172, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/bdist_egg.py", line 158, in call_command
self.run_command(cmdname)
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/install_lib.py", line 11, in run
self.build()
File "/usr/lib/python2.7/distutils/command/install_lib.py", line 111, in build
self.run_command('build_ext')
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/git/cupy/cupy_setup_build.py", line 815, in run
check_extensions(self.extensions)
File "/home/user1/git/cupy/cupy_setup_build.py", line 619, in check_extensions
'''.format(f, required_cython_version))
RuntimeError: running install_lib
running build_py
running build_ext
Traceback (most recent call last):
File "setup.py", line 122, in
'sdist': sdist},
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/init.py", line 140, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/install.py", line 67, in run
self.do_egg_install()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/install.py", line 109, in do_egg_install
self.run_command('bdist_egg')
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/bdist_egg.py", line 172, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/bdist_egg.py", line 158, in call_command
self.run_command(cmdname)
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/install_lib.py", line 11, in run
self.build()
File "/usr/lib/python2.7/distutils/command/install_lib.py", line 111, in build
self.run_command('build_ext')
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/git/cupy/cupy_setup_build.py", line 815, in run
check_extensions(self.extensions)
File "/home/user1/git/cupy/cupy_setup_build.py", line 619, in check_extensions
'''.running install_lib
running build_py
running build_ext
Traceback (most recent call last):
File "setup.py", line 122, in
'sdist': sdist},
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/init.py", line 140, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/install.py", line 67, in run
self.do_egg_install()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/install.py", line 109, in do_egg_install
self.run_command('bdist_egg')
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/bdist_egg.py", line 172, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/bdist_egg.py", line 158, in call_command
self.run_command(cmdname)
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/.local/lib/python2.7/site-packages/setuptools/command/install_lib.py", line 11, in run
self.build()
File "/usr/lib/python2.7/distutils/command/install_lib.py", line 111, in build
self.run_command('build_ext')
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/user1/git/cupy/cupy_setup_build.py", line 815, in run
check_extensions(self.extensions)
File "/home/user1/git/cupy/cupy_setup_build.py", line 619, in check_extensions
'''.format(f, required_cython_version))
RuntimeError: Missing file: cupy/core/_dtype.cpp
Please install Cython 0.28.0 or later. Please also check the version of Cython.
See https://docs-cupy.chainer.org/en/stable/install.html for details.format(f, required_cython_version))
RuntimeError: Missing file: cupy/core/_dtype.cpp
Please install Cython 0.28.0 or later. Please also check the version of Cython.
See https://docs-cupy.chainer.org/en/stable/install.html for details.Missing file: cupy/core/_dtype.cpp
Please install Cython 0.28.0 or later. Please also check the version of Cython.
See https://docs-cupy.chainer.org/en/stable/install.html for details.sing file: cupy/core/_dtype.cpp
Please install Cython 0.28.0 or later. Please also check the version of Cython.
See https://docs-cupy.chainer.org/en/stable/install.html for details.on 0.28.0 or later. Please also check the version of Cython.
See https://docs-cupy.chainer.org/en/stable/install.html for details.
.
Is Cython 0.28 really needed? I have 0.23 installed on the system, and Cython 0.28 is post 18.04.

@cupy cupy deleted a comment from pfn-ci-bot Aug 15, 2019
@cupy cupy deleted a comment from pfn-ci-bot Aug 15, 2019
@cupy cupy deleted a comment from pfn-ci-bot Aug 15, 2019
@cupy cupy deleted a comment from pfn-ci-bot Aug 15, 2019
@cupy cupy deleted a comment from pfn-ci-bot Aug 15, 2019
@cupy cupy deleted a comment from pfn-ci-bot Aug 15, 2019
@okuta
Copy link
Copy Markdown
Member Author

okuta commented Aug 15, 2019

/test

@pfn-ci-bot
Copy link
Copy Markdown
Collaborator

Successfully created a job for commit 87bccb2:

@okuta
Copy link
Copy Markdown
Member Author

okuta commented Aug 15, 2019

/test

@pfn-ci-bot
Copy link
Copy Markdown
Collaborator

Successfully created a job for commit 87bccb2:

@okuta okuta changed the title [Experimental] Support AMD GPU via HIP (ROCm2.6.0+) [Experimental] Support AMD GPU via HIP (ROCm2.7.0+) Aug 15, 2019
@mitmul
Copy link
Copy Markdown
Member

mitmul commented Sep 4, 2019

/test

@pfn-ci-bot
Copy link
Copy Markdown
Collaborator

Successfully created a job for commit 87bccb2:

Copy link
Copy Markdown
Member

@mitmul mitmul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just revising the document part. I will see the other part later.

okuta and others added 2 commits September 10, 2019 09:41
Fix document

Co-Authored-By: Shunta Saito <shunta.saito@gmail.com>
@mitmul
Copy link
Copy Markdown
Member

mitmul commented Sep 11, 2019

/test

@pfn-ci-bot
Copy link
Copy Markdown
Collaborator

Successfully created a job for commit 89fc5ac:

@mitmul
Copy link
Copy Markdown
Member

mitmul commented Sep 11, 2019

I discussed with @okuta offline and we concluded that this PR will be merged soon after confirming there's no critical issue in the current source and it can successfully be compiled. Then with other PRs, we'll add more tests for checking the calculation results using this feature and add more features like functions for sort/argsort etc.

@okuta
Copy link
Copy Markdown
Member Author

okuta commented Sep 18, 2019

/test

@pfn-ci-bot
Copy link
Copy Markdown
Collaborator

Successfully created a job for commit 6508fea:

@mitmul
Copy link
Copy Markdown
Member

mitmul commented Sep 18, 2019

All tests have succeeded.

@okuta
Copy link
Copy Markdown
Member Author

okuta commented Oct 2, 2019

Thank you very much!

@avimanyu786
Copy link
Copy Markdown

Thank you so much for implementing this in v7.0.0rc1! Greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:feature New features/APIs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants