Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiP: Upgrade to ROCm 3.10/4.0, add RAND modules, add Fortran pointer/target interfaces, add docu #38

Merged
merged 41 commits into from
Feb 8, 2021
Merged

WiP: Upgrade to ROCm 3.10/4.0, add RAND modules, add Fortran pointer/target interfaces, add docu #38

merged 41 commits into from
Feb 8, 2021

Conversation

domcharrier
Copy link
Contributor

@domcharrier domcharrier commented Sep 29, 2020

NOTE: This PR requires to move from -std=f2003 to -std=f2008 in order to enable overloading of
functions where only the assumed rank of an array input argument differs but not the number, name, and order of input arguments!

(Build process tries to determine now if compiler supports F2008.)
(Issue with current ROCm packaging is that we only ship only modules compatible with one gfortran module file format
per OS as we only ship one set of precompiled modules. We should actually build modules compliant to the last N gfortran module file formats.)

Fixes

  • Add value qualifier to hipStream and hipEvent where needed
  • Enum ambiguity issue when rocblas was used with rocsolver
  • Various scalar variables are now passed as reference and not anymore
    as type(c_ptr). Therefore, it is not necessary to use c_loc and to add a target qualifier
    to the declaration of these parameters in Fortran user code. Among these updated interfaces
    are hipGetDevice and various interfaces for querying device properties.

Minor fixes

  • Change copyright date to 2021

Main contributions:

  • Upgrade all modules to ROCm 3.10.

  • Add hiprand and rocrand modules

  • Add documentation for most routines.

  • HIP Runtime API:

  • HIP/ROCm Math Libs:

    • Fortran-user-friendly interfaces for malloc and memcpy operations
      • Work with Fortran pointers instead of type(c_ptr); enables easy slicing

      • Add interfaces that take scalar and vector targets for most routines.

      • Add interfaces that take higher-rank tensor target arrays into account for some interfaces
        where it is clear that one argument is a matrix or a tensor with even higher rank.

      • Add rocblas/hipblas auxiliary functions for various datatypes

Tests

  • Add tests for f2003 and f2008 modules.
    • All f2003 and f2008 tests pass with f2008 modules on MI100
    • All f2003 and f2008 tests pass with f2008 modules on V100 & A100

Example usage of the upgraded HIP runtime API:

https://raw.githubusercontent.com/ROCmSoftwarePlatform/hipfort/ef0380082af511dc68e2b1350ce287cc2f617eee/test/vecadd/main.f03

Another example that uses rocblas and HIP Runtime API:

https://raw.githubusercontent.com/ROCmSoftwarePlatform/hipfort/ef0380082af511dc68e2b1350ce287cc2f617eee/test/rocblas/saxpy.f03

@domcharrier domcharrier changed the title Upgrade to rocm3.8, add rand modules WiP: Upgrade to rocm3.8, add rand modules Sep 29, 2020
* Doxygen style docu in all modules for IDE integration
  and docu generation.
* RT literals such as hipHostMallocDefault etc
  are now loaded in hipfort module via
  hipfort_types aux module.
* hipMalloc,hipHostMalloc,hipFree,hipHostFree accept now
  Fortran pointers of type complex,integer,real (SP and DP)
  with up to seven dimensions.
  Arguments are in #elements here instead of #bytes.

* hipMemcpy,hipMemcpyAsync accept now
  Fortran pointers of type complex,integer,real (SP and DP)
  with up to seven dimensions.
  Arguments are in #elements here instead of #bytes.

* hipMemcpy2D,hipMemcpy2DAsync accept now
  2D Fortran pointers of type complex,integer,real (SP and DP).
  Arguments are in #elements here instead of #bytes.

* Modified vecadd example to work with these new interfaces.

Change required to bump up Fortran standard to 2008 in CMakeList.txt
* Upgrade all modules to ROCm 3.9.
* Add interfaces that take scalar and vector targets
  for most routines.
* Add interfaces that take higher-rank tensor target
  arrays into account for some interfaces
  where it is clear that one argument is a matrix
  or a tensor with even higher rank.
* Add rocblas/hipblas auxiliary functions for various datatypes
@domcharrier domcharrier changed the title WiP: Upgrade to rocm3.8, add rand modules WiP: Upgrade to rocm3.9, add rand modules Nov 3, 2020
@domcharrier domcharrier changed the title WiP: Upgrade to rocm3.9, add rand modules WiP: Upgrade to ROCm 3.10, add RAND modules, add Fortran pointer/target interfaces Dec 3, 2020
@domcharrier domcharrier changed the title WiP: Upgrade to ROCm 3.10, add RAND modules, add Fortran pointer/target interfaces WiP: Upgrade to ROCm 3.10, add RAND modules, add Fortran pointer/target interfaces, add docu Dec 3, 2020
@domcharrier
Copy link
Contributor Author

This PR generally adds a larger number of new APIs (coming from the upgrade to ROCm 3.10)
plus more user-friendly additional interfaces for certain APIs such as
hipMalloc and hipMemcpy as well as most Math API.

Main discussion point is if we can switch to f2008 or if this has impact of some projects that strictly require f2003.

@pbauman
Copy link
Collaborator

pbauman commented Dec 7, 2020

How much of a pain would it be to support both? I.e. detect at configure time if compiler supports the f2008 features needed and then guard with pre-processor macros. That would be my preference, but the maintenance burden is a bit bigger.

@domcharrier domcharrier linked an issue Jan 28, 2021 that may be closed by this pull request
@domcharrier domcharrier linked an issue Feb 1, 2021 that may be closed by this pull request
@domcharrier
Copy link
Contributor Author

@schoonovernumerics Can you check if this PR closes #36 ?

@domcharrier
Copy link
Contributor Author

@pbauman Can you check if this PR closes #7 ?

@domcharrier
Copy link
Contributor Author

@schoonovernumerics Can you check if this covers the test automation needs you mention in
#41 ?

* add f2003 (original) and f2008 version
* original f2003 Taken from:
  #35
@domcharrier
Copy link
Contributor Author

@malcolmroberts Please check if this PR covers #35

domcharrier and others added 6 commits February 1, 2021 16:26
cd build &&  make all-tests-run
 | Scanning dependencies of target all-tests
 | Built target all-tests
 | Scanning dependencies of target all-tests-run
 | -- Running test 'vecadd' (Fortran 2003 interfaces) -  PASSED!
 | -- Running test 'rocFFT' (Fortran 2003 interfaces) -  PASSED!
 | -- Running test 'ddoti' (Fortran 2003 interfaces) -  PASSED!
 | -- Running test 'CGEMM' (Fortran 2003 interfaces) -  PASSED!
 | -- Running test 'DGEMM' (Fortran 2003 interfaces) -  PASSED!
 | -- Running test 'dger' (Fortran 2003 interfaces) -  PASSED!
 | -- Running test 'dscal' (Fortran 2003 interfaces) -  PASSED!
 | -- Running test 'SAXPY' (Fortran 2003 interfaces) -  PASSED!
 | -- ...

and update copyright date in all files
* Collected names from CUDA 11.2 libcublas.so
@fluidnumerics-joe
Copy link
Contributor

@txomin13 I'll take a look today

* Issue was unitialized direction variable

Further:

* hipfc users must now specify offload arch with
  '--offload-arch=<...>' as in hipcc
@domcharrier
Copy link
Contributor Author

As the PR now passes all tests and adds a substantial number of new interfaces, I will merge it into develop.

@domcharrier domcharrier merged commit 782fb88 into ROCm:develop Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants