pic_array Module

Please do not modify this file to implement new methods, please go look at tools/autogen/pic_array_cpu.fypp and edit the generator.


Uses

  • module~~pic_array~~UsesGraph module~pic_array pic_array module~pic_types pic_types module~pic_array->module~pic_types iso_fortran_env iso_fortran_env module~pic_types->iso_fortran_env

Variables

Type Visibility Attributes Name Initial
integer(kind=default_int), public, parameter :: ASCENDING = 1
integer(kind=default_int), public, parameter :: DESCENDING = 2
integer(kind=default_int), private, parameter :: block_size = 32

This is the size to block over for matrices for performance purposes

logical, private :: use_threaded_default = .false.

Interfaces

public interface copy

copy provides a blas-less implementation of xcopy where x is (i,s,d) icopy, scopy, dcopy if you built pic with BLAS use the copy interface provided there, I will not beat BLAS copy is implemented for (int32, int64, sp, dp) for 1 and 2d arrays of the same types

Usage: call copy(destination, source, [optional] threaded)

This subroutine is threaded for performance purposes if threaded is set to .true.

Note

If this subroutine is called inside a omp threaded region it will run serially because of nested parallelism

  • private subroutine copy_vector_int32(dest, source, threaded)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(inout) :: dest(:)
    integer(kind=int32), intent(in) :: source(:)
    logical, intent(in), optional :: threaded
  • private subroutine copy_vector_int64(dest, source, threaded)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(inout) :: dest(:)
    integer(kind=int64), intent(in) :: source(:)
    logical, intent(in), optional :: threaded
  • private subroutine copy_vector_sp(dest, source, threaded)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=sp), intent(inout) :: dest(:)
    real(kind=sp), intent(in) :: source(:)
    logical, intent(in), optional :: threaded
  • private subroutine copy_vector_dp(dest, source, threaded)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(inout) :: dest(:)
    real(kind=dp), intent(in) :: source(:)
    logical, intent(in), optional :: threaded
  • private subroutine copy_matrix_int32(dest, source, threaded)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(inout) :: dest(:,:)
    integer(kind=int32), intent(in) :: source(:,:)
    logical, intent(in), optional :: threaded
  • private subroutine copy_matrix_int64(dest, source, threaded)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(inout) :: dest(:,:)
    integer(kind=int64), intent(in) :: source(:,:)
    logical, intent(in), optional :: threaded
  • private subroutine copy_matrix_sp(dest, source, threaded)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=sp), intent(inout) :: dest(:,:)
    real(kind=sp), intent(in) :: source(:,:)
    logical, intent(in), optional :: threaded
  • private subroutine copy_matrix_dp(dest, source, threaded)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(inout) :: dest(:,:)
    real(kind=dp), intent(in) :: source(:,:)
    logical, intent(in), optional :: threaded

public interface fill

fill provides a generic interface to assing a value alpha of types (int32, int64, sp, dp) as defined in pic_types.F90 The inteface supports filling 1d and 2d arrays of the specified variables

Usage: call fill(array, value, [optional] threaded)

This subroutine is threaded for performance purposes if threaded is set to .true.

Note

If this subroutine is called inside a omp threaded region it will run serially because of nested parallelism

  • private subroutine fill_vector_int32(vector, alpha, threaded)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(inout) :: vector(:)
    integer(kind=int32), intent(in) :: alpha
    logical, intent(in), optional :: threaded
  • private subroutine fill_vector_int64(vector, alpha, threaded)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(inout) :: vector(:)
    integer(kind=int64), intent(in) :: alpha
    logical, intent(in), optional :: threaded
  • private subroutine fill_vector_sp(vector, alpha, threaded)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=sp), intent(inout) :: vector(:)
    real(kind=sp), intent(in) :: alpha
    logical, intent(in), optional :: threaded
  • private subroutine fill_vector_dp(vector, alpha, threaded)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(inout) :: vector(:)
    real(kind=dp), intent(in) :: alpha
    logical, intent(in), optional :: threaded
  • private subroutine fill_matrix_int32(matrix, alpha, threaded)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(inout) :: matrix(:,:)
    integer(kind=int32), intent(in) :: alpha
    logical, intent(in), optional :: threaded
  • private subroutine fill_matrix_int64(matrix, alpha, threaded)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(inout) :: matrix(:,:)
    integer(kind=int64), intent(in) :: alpha
    logical, intent(in), optional :: threaded
  • private subroutine fill_matrix_sp(matrix, alpha, threaded)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=sp), intent(inout) :: matrix(:,:)
    real(kind=sp), intent(in) :: alpha
    logical, intent(in), optional :: threaded
  • private subroutine fill_matrix_dp(matrix, alpha, threaded)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(inout) :: matrix(:,:)
    real(kind=dp), intent(in) :: alpha
    logical, intent(in), optional :: threaded

public interface is_sorted

is_sorted provides a simple way to checking if a 1d array is sorted it is implemented for int32, int64, sp, and dp datatypes. The default is to check if an array is sorted in ascending fashion.

Usage: result = is_sorted(array, [optional] ASCENDING/DESCENDING)

  • private pure function is_sorted_int32(array, order) result(sorted)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: array(:)
    integer(kind=default_int), intent(in), optional :: order

    Return Value logical

  • private pure function is_sorted_int64(array, order) result(sorted)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(in) :: array(:)
    integer(kind=default_int), intent(in), optional :: order

    Return Value logical

  • private pure function is_sorted_sp(array, order) result(sorted)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=sp), intent(in) :: array(:)
    integer(kind=default_int), intent(in), optional :: order

    Return Value logical

  • private pure function is_sorted_dp(array, order) result(sorted)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(in) :: array(:)
    integer(kind=default_int), intent(in), optional :: order

    Return Value logical

public interface pic_sum

pic_sum provides a threaded alternative to the sum(array) Fortran intrinsic which will be too slow for large sizes of vectors and matrices. Note that this provides the total sum. As opposed to the blas alternative XASUM which does the absolute sum

pic_sum is implemented for (int32, int64, sp, dp) 1 and 2d arrays

Usage: result = pic_sum(array, [optional] threaded)

This subroutine is threaded for performance purposes if threaded is set to true

Note

If this subroutine is called inside a omp threaded region it will run serially because of nested parallelism

  • private function sum_vector_int32(vector, threaded) result(res)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: vector(:)
    logical, intent(in), optional :: threaded

    Return Value integer(kind=int32)

  • private function sum_vector_int64(vector, threaded) result(res)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(in) :: vector(:)
    logical, intent(in), optional :: threaded

    Return Value integer(kind=int64)

  • private function sum_vector_sp(vector, threaded) result(res)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=sp), intent(in) :: vector(:)
    logical, intent(in), optional :: threaded

    Return Value real(kind=sp)

  • private function sum_vector_dp(vector, threaded) result(res)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(in) :: vector(:)
    logical, intent(in), optional :: threaded

    Return Value real(kind=dp)

  • private function sum_matrix_int32(matrix, threaded) result(res)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: matrix(:,:)
    logical, intent(in), optional :: threaded

    Return Value integer(kind=int32)

  • private function sum_matrix_int64(matrix, threaded) result(res)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(in) :: matrix(:,:)
    logical, intent(in), optional :: threaded

    Return Value integer(kind=int64)

  • private function sum_matrix_sp(matrix, threaded) result(res)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=sp), intent(in) :: matrix(:,:)
    logical, intent(in), optional :: threaded

    Return Value real(kind=sp)

  • private function sum_matrix_dp(matrix, threaded) result(res)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(in) :: matrix(:,:)
    logical, intent(in), optional :: threaded

    Return Value real(kind=dp)

public interface pic_transpose

pic_transpose provides a blas-less, threaded alternative to the Fortran transpose intrinsic which will be slow for large matrix sizes. pic_transpose does not assume symmetric matrices

pic_transpose is implemented for (int32, int64, sp, dp) 2d arrays

Usage: call pic_transpose(matrix_to_transpose, result, [optional] threaded)

This subroutine is threaded for performance purposes if threaded is set to true

Note

If this subroutine is called inside a omp threaded region it will run serially because of nested parallelism

  • private subroutine transpose_matrix_int32(A, B, threaded)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: A(:,:)
    integer(kind=int32), intent(out) :: B(:,:)
    logical, intent(in), optional :: threaded
  • private subroutine transpose_matrix_int64(A, B, threaded)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(in) :: A(:,:)
    integer(kind=int64), intent(out) :: B(:,:)
    logical, intent(in), optional :: threaded
  • private subroutine transpose_matrix_sp(A, B, threaded)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=sp), intent(in) :: A(:,:)
    real(kind=sp), intent(out) :: B(:,:)
    logical, intent(in), optional :: threaded
  • private subroutine transpose_matrix_dp(A, B, threaded)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(in) :: A(:,:)
    real(kind=dp), intent(out) :: B(:,:)
    logical, intent(in), optional :: threaded

private interface get_threading_mode

get_threading_mode returns the current threading mode for the array routines Usage: mode = get_threading_mode()

  • private interface get_threading_mode()

    get_threading_mode returns the current threading mode for the array routines Usage: mode = get_threading_mode()

    Arguments

    None

private interface set_threading_mode

set_threading sets the threading mode for the array routines this will set the use_threaded variable to true or false depending on the input Usage: call set_threading_mode(.true.) or call set_threading_mode(.false.)

  • private interface set_threading_mode()

    set_threading sets the threading mode for the array routines this will set the use_threaded variable to true or false depending on the input Usage: call set_threading_mode(.true.) or call set_threading_mode(.false.)

    Arguments

    None

Functions

public function get_threading_mode() result(mode)

get the current threading mode for the array routines Usage: mode = get_threading_mode()

Arguments

None

Return Value logical

private pure function is_sorted_dp(array, order) result(sorted)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: array(:)
integer(kind=default_int), intent(in), optional :: order

Return Value logical

private pure function is_sorted_int32(array, order) result(sorted)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: array(:)
integer(kind=default_int), intent(in), optional :: order

Return Value logical

private pure function is_sorted_int64(array, order) result(sorted)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: array(:)
integer(kind=default_int), intent(in), optional :: order

Return Value logical

private pure function is_sorted_sp(array, order) result(sorted)

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(in) :: array(:)
integer(kind=default_int), intent(in), optional :: order

Return Value logical

private function sum_matrix_dp(matrix, threaded) result(res)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: matrix(:,:)
logical, intent(in), optional :: threaded

Return Value real(kind=dp)

private function sum_matrix_int32(matrix, threaded) result(res)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: matrix(:,:)
logical, intent(in), optional :: threaded

Return Value integer(kind=int32)

private function sum_matrix_int64(matrix, threaded) result(res)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: matrix(:,:)
logical, intent(in), optional :: threaded

Return Value integer(kind=int64)

private function sum_matrix_sp(matrix, threaded) result(res)

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(in) :: matrix(:,:)
logical, intent(in), optional :: threaded

Return Value real(kind=sp)

private function sum_vector_dp(vector, threaded) result(res)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: vector(:)
logical, intent(in), optional :: threaded

Return Value real(kind=dp)

private function sum_vector_int32(vector, threaded) result(res)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: vector(:)
logical, intent(in), optional :: threaded

Return Value integer(kind=int32)

private function sum_vector_int64(vector, threaded) result(res)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: vector(:)
logical, intent(in), optional :: threaded

Return Value integer(kind=int64)

private function sum_vector_sp(vector, threaded) result(res)

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(in) :: vector(:)
logical, intent(in), optional :: threaded

Return Value real(kind=sp)


Subroutines

public subroutine set_threading_mode(threaded)

set the threading mode for the array routines, this will set the use_threaded variable to true or false depending on the input

Read more…

Arguments

Type IntentOptional Attributes Name
logical, intent(in) :: threaded

private subroutine copy_matrix_dp(dest, source, threaded)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: dest(:,:)
real(kind=dp), intent(in) :: source(:,:)
logical, intent(in), optional :: threaded

private subroutine copy_matrix_int32(dest, source, threaded)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout) :: dest(:,:)
integer(kind=int32), intent(in) :: source(:,:)
logical, intent(in), optional :: threaded

private subroutine copy_matrix_int64(dest, source, threaded)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(inout) :: dest(:,:)
integer(kind=int64), intent(in) :: source(:,:)
logical, intent(in), optional :: threaded

private subroutine copy_matrix_sp(dest, source, threaded)

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(inout) :: dest(:,:)
real(kind=sp), intent(in) :: source(:,:)
logical, intent(in), optional :: threaded

private subroutine copy_vector_dp(dest, source, threaded)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: dest(:)
real(kind=dp), intent(in) :: source(:)
logical, intent(in), optional :: threaded

private subroutine copy_vector_int32(dest, source, threaded)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout) :: dest(:)
integer(kind=int32), intent(in) :: source(:)
logical, intent(in), optional :: threaded

private subroutine copy_vector_int64(dest, source, threaded)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(inout) :: dest(:)
integer(kind=int64), intent(in) :: source(:)
logical, intent(in), optional :: threaded

private subroutine copy_vector_sp(dest, source, threaded)

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(inout) :: dest(:)
real(kind=sp), intent(in) :: source(:)
logical, intent(in), optional :: threaded

private subroutine fill_matrix_dp(matrix, alpha, threaded)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: matrix(:,:)
real(kind=dp), intent(in) :: alpha
logical, intent(in), optional :: threaded

private subroutine fill_matrix_int32(matrix, alpha, threaded)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout) :: matrix(:,:)
integer(kind=int32), intent(in) :: alpha
logical, intent(in), optional :: threaded

private subroutine fill_matrix_int64(matrix, alpha, threaded)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(inout) :: matrix(:,:)
integer(kind=int64), intent(in) :: alpha
logical, intent(in), optional :: threaded

private subroutine fill_matrix_sp(matrix, alpha, threaded)

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(inout) :: matrix(:,:)
real(kind=sp), intent(in) :: alpha
logical, intent(in), optional :: threaded

private subroutine fill_vector_dp(vector, alpha, threaded)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: vector(:)
real(kind=dp), intent(in) :: alpha
logical, intent(in), optional :: threaded

private subroutine fill_vector_int32(vector, alpha, threaded)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout) :: vector(:)
integer(kind=int32), intent(in) :: alpha
logical, intent(in), optional :: threaded

private subroutine fill_vector_int64(vector, alpha, threaded)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(inout) :: vector(:)
integer(kind=int64), intent(in) :: alpha
logical, intent(in), optional :: threaded

private subroutine fill_vector_sp(vector, alpha, threaded)

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(inout) :: vector(:)
real(kind=sp), intent(in) :: alpha
logical, intent(in), optional :: threaded

private subroutine transpose_matrix_dp(A, B, threaded)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: A(:,:)
real(kind=dp), intent(out) :: B(:,:)
logical, intent(in), optional :: threaded

private subroutine transpose_matrix_int32(A, B, threaded)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: A(:,:)
integer(kind=int32), intent(out) :: B(:,:)
logical, intent(in), optional :: threaded

private subroutine transpose_matrix_int64(A, B, threaded)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: A(:,:)
integer(kind=int64), intent(out) :: B(:,:)
logical, intent(in), optional :: threaded

private subroutine transpose_matrix_sp(A, B, threaded)

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(in) :: A(:,:)
real(kind=sp), intent(out) :: B(:,:)
logical, intent(in), optional :: threaded