mirror of
https://github.com/sfilippone/psblas3.git
synced 2026-10-20 04:42:08 +00:00
Define check_addr
This commit is contained in:
@@ -42,6 +42,14 @@ int registerMappedFloatComplex(void *buff, void **d_p, int n, cuFloatComplex du
|
||||
return registerMappedMemory(buff,d_p,((size_t) n)*sizeof(cuFloatComplex));
|
||||
}
|
||||
|
||||
int checkMultiVecDeviceFloatComplex(void* deviceMultiVec)
|
||||
{
|
||||
struct MultiVectDevice *devVec = (struct MultiVectDevice *) deviceMultiVec;
|
||||
fprintf(stderr,"checkMultiVecDeviceInt Size: %d Pointer %p\n",
|
||||
devVec->size_,devVec->v_);
|
||||
return(0);
|
||||
}
|
||||
|
||||
int writeMultiVecDeviceFloatComplex(void* deviceVec, cuFloatComplex* hostVec)
|
||||
{ int i;
|
||||
struct MultiVectDevice *devVec = (struct MultiVectDevice *) deviceVec;
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "vector.h"
|
||||
|
||||
int registerMappedFloatComplex(void *, void **, int, cuFloatComplex);
|
||||
int checkMultiVecDeviceFloatComplex(void* deviceMultiVec);
|
||||
int writeMultiVecDeviceFloatComplex(void* deviceMultiVec, cuFloatComplex* hostMultiVec);
|
||||
int writeMultiVecDeviceFloatComplexR2(void* deviceMultiVec, cuFloatComplex* hostMultiVec, int ld);
|
||||
int readMultiVecDeviceFloatComplex(void* deviceMultiVec, cuFloatComplex* hostMultiVec);
|
||||
|
||||
@@ -42,6 +42,14 @@ int registerMappedDouble(void *buff, void **d_p, int n, double dummy)
|
||||
return registerMappedMemory(buff,d_p,((size_t) n)*sizeof(double));
|
||||
}
|
||||
|
||||
int checkMultiVecDeviceDouble(void* deviceMultiVec)
|
||||
{
|
||||
struct MultiVectDevice *devVec = (struct MultiVectDevice *) deviceMultiVec;
|
||||
fprintf(stderr,"checkMultiVecDeviceInt Size: %d Pointer %p\n",
|
||||
devVec->size_,devVec->v_);
|
||||
return(0);
|
||||
}
|
||||
|
||||
int writeMultiVecDeviceDouble(void* deviceVec, double* hostVec)
|
||||
{ int i;
|
||||
struct MultiVectDevice *devVec = (struct MultiVectDevice *) deviceVec;
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "vector.h"
|
||||
|
||||
int registerMappedDouble(void *, void **, int, double);
|
||||
int checkMultiVecDeviceDouble(void* deviceMultiVec);
|
||||
int writeMultiVecDeviceDouble(void* deviceMultiVec, double* hostMultiVec);
|
||||
int writeMultiVecDeviceDoubleR2(void* deviceMultiVec, double* hostMultiVec, int ld);
|
||||
int readMultiVecDeviceDouble(void* deviceMultiVec, double* hostMultiVec);
|
||||
|
||||
@@ -86,6 +86,7 @@ module psb_c_cuda_vect_mod
|
||||
procedure, nopass :: device_wait => c_cuda_device_wait
|
||||
procedure, pass(x) :: free_buffer => c_cuda_free_buffer
|
||||
procedure, pass(x) :: maybe_free_buffer => c_cuda_maybe_free_buffer
|
||||
procedure, pass(x) :: check_addr => c_cuda_check_addr
|
||||
procedure, pass(x) :: dot_v => c_cuda_dot_v
|
||||
procedure, pass(x) :: dot_a => c_cuda_dot_a
|
||||
procedure, pass(y) :: axpby_v => c_cuda_axpby_v
|
||||
@@ -219,6 +220,17 @@ contains
|
||||
|
||||
end subroutine c_cuda_free_buffer
|
||||
|
||||
subroutine c_cuda_check_addr(x)
|
||||
class(psb_c_vect_cuda), intent(inout) :: x
|
||||
integer(psb_ipk_) info;
|
||||
select type(ii=> x)
|
||||
class is (psb_c_vect_cuda)
|
||||
info = checkMultiVecDeviceFloatComplex(x%deviceVect)
|
||||
class default
|
||||
write(0,*) 'Check addr: cuda version, why am I here? '
|
||||
end select
|
||||
end subroutine c_cuda_check_addr
|
||||
|
||||
subroutine c_cuda_gthzv_x(i,n,idx,x,y)
|
||||
use psb_cuda_env_mod
|
||||
use psi_serial_mod
|
||||
|
||||
@@ -44,6 +44,15 @@ module psb_c_vectordev_mod
|
||||
end function registerMappedFloatComplex
|
||||
end interface
|
||||
|
||||
interface
|
||||
function checkMultiVecDeviceFloatComplex(deviceVec) &
|
||||
& result(res) bind(c,name='checkMultiVecDeviceFloatComplex')
|
||||
use iso_c_binding
|
||||
integer(c_int) :: res
|
||||
type(c_ptr), value :: deviceVec
|
||||
end function checkMultiVecDeviceFloatComplex
|
||||
end interface
|
||||
|
||||
interface writeMultiVecDevice
|
||||
function writeMultiVecDeviceFloatComplex(deviceVec,hostVec) &
|
||||
& result(res) bind(c,name='writeMultiVecDeviceFloatComplex')
|
||||
|
||||
@@ -86,6 +86,7 @@ module psb_d_cuda_vect_mod
|
||||
procedure, nopass :: device_wait => d_cuda_device_wait
|
||||
procedure, pass(x) :: free_buffer => d_cuda_free_buffer
|
||||
procedure, pass(x) :: maybe_free_buffer => d_cuda_maybe_free_buffer
|
||||
procedure, pass(x) :: check_addr => d_cuda_check_addr
|
||||
procedure, pass(x) :: dot_v => d_cuda_dot_v
|
||||
procedure, pass(x) :: dot_a => d_cuda_dot_a
|
||||
procedure, pass(y) :: axpby_v => d_cuda_axpby_v
|
||||
@@ -219,6 +220,17 @@ contains
|
||||
|
||||
end subroutine d_cuda_free_buffer
|
||||
|
||||
subroutine d_cuda_check_addr(x)
|
||||
class(psb_d_vect_cuda), intent(inout) :: x
|
||||
integer(psb_ipk_) info;
|
||||
select type(ii=> x)
|
||||
class is (psb_d_vect_cuda)
|
||||
info = checkMultiVecDeviceDouble(x%deviceVect)
|
||||
class default
|
||||
write(0,*) 'Check addr: cuda version, why am I here? '
|
||||
end select
|
||||
end subroutine d_cuda_check_addr
|
||||
|
||||
subroutine d_cuda_gthzv_x(i,n,idx,x,y)
|
||||
use psb_cuda_env_mod
|
||||
use psi_serial_mod
|
||||
|
||||
@@ -44,6 +44,15 @@ module psb_d_vectordev_mod
|
||||
end function registerMappedDouble
|
||||
end interface
|
||||
|
||||
interface
|
||||
function checkMultiVecDeviceDouble(deviceVec) &
|
||||
& result(res) bind(c,name='checkMultiVecDeviceDouble')
|
||||
use iso_c_binding
|
||||
integer(c_int) :: res
|
||||
type(c_ptr), value :: deviceVec
|
||||
end function checkMultiVecDeviceDouble
|
||||
end interface
|
||||
|
||||
interface writeMultiVecDevice
|
||||
function writeMultiVecDeviceDouble(deviceVec,hostVec) &
|
||||
& result(res) bind(c,name='writeMultiVecDeviceDouble')
|
||||
|
||||
@@ -83,8 +83,8 @@ module psb_i_cuda_vect_mod
|
||||
procedure, nopass :: device_wait => i_cuda_device_wait
|
||||
procedure, pass(x) :: free_buffer => i_cuda_free_buffer
|
||||
procedure, pass(x) :: maybe_free_buffer => i_cuda_maybe_free_buffer
|
||||
|
||||
procedure, pass(x) :: check_addr => i_cuda_check_addr
|
||||
|
||||
final :: i_cuda_vect_finalize
|
||||
end type psb_i_vect_cuda
|
||||
|
||||
@@ -213,7 +213,6 @@ contains
|
||||
end select
|
||||
end subroutine i_cuda_check_addr
|
||||
|
||||
|
||||
subroutine i_cuda_gthzv_x(i,n,idx,x,y)
|
||||
use psb_cuda_env_mod
|
||||
use psi_serial_mod
|
||||
@@ -811,12 +810,12 @@ contains
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
info = 0
|
||||
if (allocated(x%v)) deallocate(x%v, stat=info)
|
||||
if (c_associated(x%deviceVect)) then
|
||||
!!$ write(0,*)'d_cuda_free Calling freeMultiVecDevice'
|
||||
call freeMultiVecDevice(x%deviceVect)
|
||||
x%deviceVect=c_null_ptr
|
||||
end if
|
||||
if (allocated(x%v)) deallocate(x%v, stat=info)
|
||||
call x%free_buffer(info)
|
||||
call x%set_sync()
|
||||
end subroutine i_cuda_free
|
||||
|
||||
@@ -44,6 +44,15 @@ module psb_i_vectordev_mod
|
||||
end function registerMappedInt
|
||||
end interface
|
||||
|
||||
interface
|
||||
function checkMultiVecDeviceInt(deviceVec) &
|
||||
& result(res) bind(c,name='checkMultiVecDeviceInt')
|
||||
use iso_c_binding
|
||||
integer(c_int) :: res
|
||||
type(c_ptr), value :: deviceVec
|
||||
end function checkMultiVecDeviceInt
|
||||
end interface
|
||||
|
||||
interface writeMultiVecDevice
|
||||
function writeMultiVecDeviceInt(deviceVec,hostVec) &
|
||||
& result(res) bind(c,name='writeMultiVecDeviceInt')
|
||||
@@ -122,15 +131,6 @@ module psb_i_vectordev_mod
|
||||
integer(c_int) :: hidx(m,*)
|
||||
integer(c_int),value :: m,n
|
||||
end function writeMultiInt
|
||||
end interface writeInt
|
||||
|
||||
interface
|
||||
function checkMultiVecDeviceInt(deviceVec) &
|
||||
& result(res) bind(c,name='checkMultiVecDeviceInt')
|
||||
use iso_c_binding
|
||||
integer(c_int) :: res
|
||||
type(c_ptr), value :: deviceVec
|
||||
end function checkMultiVecDeviceInt
|
||||
end interface
|
||||
|
||||
interface readInt
|
||||
|
||||
@@ -86,6 +86,7 @@ module psb_s_cuda_vect_mod
|
||||
procedure, nopass :: device_wait => s_cuda_device_wait
|
||||
procedure, pass(x) :: free_buffer => s_cuda_free_buffer
|
||||
procedure, pass(x) :: maybe_free_buffer => s_cuda_maybe_free_buffer
|
||||
procedure, pass(x) :: check_addr => s_cuda_check_addr
|
||||
procedure, pass(x) :: dot_v => s_cuda_dot_v
|
||||
procedure, pass(x) :: dot_a => s_cuda_dot_a
|
||||
procedure, pass(y) :: axpby_v => s_cuda_axpby_v
|
||||
@@ -219,6 +220,17 @@ contains
|
||||
|
||||
end subroutine s_cuda_free_buffer
|
||||
|
||||
subroutine s_cuda_check_addr(x)
|
||||
class(psb_s_vect_cuda), intent(inout) :: x
|
||||
integer(psb_ipk_) info;
|
||||
select type(ii=> x)
|
||||
class is (psb_s_vect_cuda)
|
||||
info = checkMultiVecDeviceFloat(x%deviceVect)
|
||||
class default
|
||||
write(0,*) 'Check addr: cuda version, why am I here? '
|
||||
end select
|
||||
end subroutine s_cuda_check_addr
|
||||
|
||||
subroutine s_cuda_gthzv_x(i,n,idx,x,y)
|
||||
use psb_cuda_env_mod
|
||||
use psi_serial_mod
|
||||
|
||||
@@ -44,6 +44,15 @@ module psb_s_vectordev_mod
|
||||
end function registerMappedFloat
|
||||
end interface
|
||||
|
||||
interface
|
||||
function checkMultiVecDeviceFloat(deviceVec) &
|
||||
& result(res) bind(c,name='checkMultiVecDeviceFloat')
|
||||
use iso_c_binding
|
||||
integer(c_int) :: res
|
||||
type(c_ptr), value :: deviceVec
|
||||
end function checkMultiVecDeviceFloat
|
||||
end interface
|
||||
|
||||
interface writeMultiVecDevice
|
||||
function writeMultiVecDeviceFloat(deviceVec,hostVec) &
|
||||
& result(res) bind(c,name='writeMultiVecDeviceFloat')
|
||||
|
||||
@@ -86,6 +86,7 @@ module psb_z_cuda_vect_mod
|
||||
procedure, nopass :: device_wait => z_cuda_device_wait
|
||||
procedure, pass(x) :: free_buffer => z_cuda_free_buffer
|
||||
procedure, pass(x) :: maybe_free_buffer => z_cuda_maybe_free_buffer
|
||||
procedure, pass(x) :: check_addr => z_cuda_check_addr
|
||||
procedure, pass(x) :: dot_v => z_cuda_dot_v
|
||||
procedure, pass(x) :: dot_a => z_cuda_dot_a
|
||||
procedure, pass(y) :: axpby_v => z_cuda_axpby_v
|
||||
@@ -219,6 +220,17 @@ contains
|
||||
|
||||
end subroutine z_cuda_free_buffer
|
||||
|
||||
subroutine z_cuda_check_addr(x)
|
||||
class(psb_z_vect_cuda), intent(inout) :: x
|
||||
integer(psb_ipk_) info;
|
||||
select type(ii=> x)
|
||||
class is (psb_z_vect_cuda)
|
||||
info = checkMultiVecDeviceDoubleComplex(x%deviceVect)
|
||||
class default
|
||||
write(0,*) 'Check addr: cuda version, why am I here? '
|
||||
end select
|
||||
end subroutine z_cuda_check_addr
|
||||
|
||||
subroutine z_cuda_gthzv_x(i,n,idx,x,y)
|
||||
use psb_cuda_env_mod
|
||||
use psi_serial_mod
|
||||
|
||||
@@ -44,6 +44,15 @@ module psb_z_vectordev_mod
|
||||
end function registerMappedDoubleComplex
|
||||
end interface
|
||||
|
||||
interface
|
||||
function checkMultiVecDeviceDoubleComplex(deviceVec) &
|
||||
& result(res) bind(c,name='checkMultiVecDeviceDoubleComplex')
|
||||
use iso_c_binding
|
||||
integer(c_int) :: res
|
||||
type(c_ptr), value :: deviceVec
|
||||
end function checkMultiVecDeviceDoubleComplex
|
||||
end interface
|
||||
|
||||
interface writeMultiVecDevice
|
||||
function writeMultiVecDeviceDoubleComplex(deviceVec,hostVec) &
|
||||
& result(res) bind(c,name='writeMultiVecDeviceDoubleComplex')
|
||||
|
||||
@@ -42,6 +42,14 @@ int registerMappedFloat(void *buff, void **d_p, int n, float dummy)
|
||||
return registerMappedMemory(buff,d_p,((size_t) n)*sizeof(float));
|
||||
}
|
||||
|
||||
int checkMultiVecDeviceFloat(void* deviceMultiVec)
|
||||
{
|
||||
struct MultiVectDevice *devVec = (struct MultiVectDevice *) deviceMultiVec;
|
||||
fprintf(stderr,"checkMultiVecDeviceInt Size: %d Pointer %p\n",
|
||||
devVec->size_,devVec->v_);
|
||||
return(0);
|
||||
}
|
||||
|
||||
int writeMultiVecDeviceFloat(void* deviceVec, float* hostVec)
|
||||
{ int i;
|
||||
struct MultiVectDevice *devVec = (struct MultiVectDevice *) deviceVec;
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "vector.h"
|
||||
|
||||
int registerMappedFloat(void *, void **, int, float);
|
||||
int checkMultiVecDeviceFloat(void* deviceMultiVec);
|
||||
int writeMultiVecDeviceFloat(void* deviceMultiVec, float* hostMultiVec);
|
||||
int writeMultiVecDeviceFloatR2(void* deviceMultiVec, float* hostMultiVec, int ld);
|
||||
int readMultiVecDeviceFloat(void* deviceMultiVec, float* hostMultiVec);
|
||||
|
||||
@@ -42,6 +42,14 @@ int registerMappedDoubleComplex(void *buff, void **d_p, int n, cuDoubleComplex
|
||||
return registerMappedMemory(buff,d_p,((size_t) n)*sizeof(cuDoubleComplex));
|
||||
}
|
||||
|
||||
int checkMultiVecDeviceDoubleComplex(void* deviceMultiVec)
|
||||
{
|
||||
struct MultiVectDevice *devVec = (struct MultiVectDevice *) deviceMultiVec;
|
||||
fprintf(stderr,"checkMultiVecDeviceInt Size: %d Pointer %p\n",
|
||||
devVec->size_,devVec->v_);
|
||||
return(0);
|
||||
}
|
||||
|
||||
int writeMultiVecDeviceDoubleComplex(void* deviceVec, cuDoubleComplex* hostVec)
|
||||
{ int i;
|
||||
struct MultiVectDevice *devVec = (struct MultiVectDevice *) deviceVec;
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "vector.h"
|
||||
|
||||
int registerMappedDoubleComplex(void *, void **, int, cuDoubleComplex);
|
||||
int checkMultiVecDeviceDoubleComplex(void* deviceMultiVec);
|
||||
int writeMultiVecDeviceDoubleComplex(void* deviceMultiVec, cuDoubleComplex* hostMultiVec);
|
||||
int writeMultiVecDeviceDoubleComplexR2(void* deviceMultiVec,
|
||||
cuDoubleComplex* hostMultiVec, int ld);
|
||||
|
||||
Reference in New Issue
Block a user