<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">Hi all</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">I am very new to PETSc. I just learnt its class structure and I just understood that the interface Vec has been reimplemented with the class VecCUSP that is able to support GPU. My question is: if I have a simple code that allocates a vector and sets it with the database options, if I specify -vec_type seqcusp then this vector is allocated AND computed on the GPU?</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">Because I compared the execution time of the same algorithm with the database options -vec_type seq and -vec_type seqcusp: these two times are very close.</div><div style="font-family:
 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">This is the code: I'm just trying to compute how long does it take to execute the function VecScale:</div><div><div><font face="times new roman, new york, times, serif">#include <petscvec.h></font></div><div><font face="times new roman, new york, times, serif">#include <string.h></font></div><div><font face="times new roman, new york, times, serif"><br></font></div><div><font face="times new roman, new york, times, serif">#undef __FUNCT__</font></div><div><font face="times new roman, new york, times, serif">#define __FUNCT__ "main"</font></div><div><font face="times new roman, new york, times, serif">int main(int argc,char **argv)</font></div><div><font face="times new roman, new york, times, serif">{</font></div><div><font face="times new roman, new york, times, serif">  Vec
            x;</font></div><div><font face="times new roman, new york, times, serif">  PetscInt       n;</font></div><div><font face="times new roman, new york, times, serif">  PetscErrorCode ierr;</font></div><div><font face="times new roman, new york, times, serif">  PetscBool exists;</font></div><div><font face="times new roman, new york, times, serif">  PetscLogDouble  t1,t2;</font></div><div><font face="times new roman, new york, times, serif">  PetscInt a=10;</font></div><div><font face="times new roman, new york, times, serif"><br></font></div><div><span style="font-family: 'times new roman', 'new york', times, serif; ">  ierr = PetscInitialize(&argc,&argv,(char*)0,help);CHKERRQ(ierr); </span><br></div><div><font face="times new roman, new york, times, serif"><br></font></div><div><font face="times new roman, new york, times, serif">  ierr =
 PetscOptionsGetInt(PETSC_NULL,"-size",&n,&exists); CHKERRQ(ierr);</font></div><div><font face="times new roman, new york, times, serif"><br></font></div><div><span style="font-family: 'times new roman', 'new york', times, serif; ">  ierr = VecCreate(PETSC_COMM_SELF,&x);CHKERRQ(ierr);</span><br></div><div><font face="times new roman, new york, times, serif">  ierr = VecSetSizes(x,PETSC_DECIDE,n);CHKERRQ(ierr);</font></div><div><font face="times new roman, new york, times, serif">  ierr = VecSetFromOptions(x);CHKERRQ(ierr);</font></div><div><font face="times new roman, new york, times, serif"><br></font></div><div><font face="times new roman, new york, times, serif">  ierr = VecSetRandom(x, PETSC_NULL); CHKERRQ(ierr);</font></div><div><font face="times new roman, new york, times, serif"><br></font></div><div><font face="times new roman, new york, times, serif">  PetscGetTime(&t1);</font></div><div><font face="times
 new roman, new york, times, serif">  ierr = VecScale(x,a); CHKERRQ(ierr);</font></div><div><font face="times new roman, new york, times, serif">  PetscGetTime(&t2);</font></div><div><font face="times new roman, new york, times, serif">  ierr = PetscPrintf(PETSC_COMM_WORLD, "%2.5f\n",(t2-t1));</font></div><div><font face="times new roman, new york, times, serif"><br></font></div><div><span style="font-family: 'times new roman', 'new york', times, serif; ">  ierr = VecDestroy(&x);CHKERRQ(ierr);</span><br></div><div><font face="times new roman, new york, times, serif"><br></font></div><div><span style="font-family: 'times new roman', 'new york', times, serif; ">  ierr = PetscFinalize();</span><br></div><div><font face="times new roman, new york, times, serif">  return 0;</font></div><div><font face="times new roman, new york, times, serif">}</font></div><div><font face="times new roman, new york, times,
 serif"><br></font></div><div><font face="times new roman, new york, times, serif">I use a  vector of about 500000 numbers. With the database option -vec_type seqcusp , the method VecScale should call the method VecScale_SeqCUSP, right? Am I wrong? Should I do it expressly?</font></div><div><font face="times new roman, new york, times, serif">Anyway with the option -vec_type seq , the method VecScale takes 0.05681 seconds, </font></div><div><font face="times new roman, new york, times, serif">with the option -vec_type seqcusp, </font><span style="font-family: 'times new roman', 'new york', times, serif; "> </span><span style="font-family: 'times new roman', 'new york', times, serif; ">the method VecScale takes 0.04242 seconds.</span></div><div><span style="font-family: 'times new roman', 'new york', times, serif; "><br></span></div><div><span style="font-family: 'times new roman', 'new york', times, serif; ">Is this
 speed up sufficient and realistic?</span></div><div><span style="font-family: 'times new roman', 'new york', times, serif; ">thanks</span></div><div><span style="font-family: 'times new roman', 'new york', times, serif; "><br></span></div><div><span style="font-family: 'times new roman', 'new york', times, serif; ">Olga</span></div></div></div></body></html>