[petsc-users] about array in VecCreateMPIWithArray()
Dear PETSc developers, my question is what type of array is need for VecCreateMPIWithArray? it is parallel distributed, that each processor holds local values of the array? or each processor has a copy of all the values of the array? PetscErrorCode VecCreateMPIWithArray(MPI_Comm comm,PetscInt n,PetscInt N,const PetscScalar array[],Vec *vv) I didn't find more information about the array from the manual. http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecCreateMPIWithArray.html Thanks a lot, Yujie -- next part -- An HTML attachment was scrubbed... URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120413/6a9e8aba/attachment.htm
[petsc-users] about array in VecCreateMPIWithArray()
On Fri, Apr 13, 2012 at 11:37 AM, recrusader recrusader at gmail.com wrote: Dear PETSc developers, my question is what type of array is need for VecCreateMPIWithArray? it is parallel distributed, that each processor holds local values of the array? or each processor has a copy of all the values of the array? Only local values. Matt PetscErrorCode VecCreateMPIWithArray(MPI_Comm comm,PetscInt n,PetscInt N,const PetscScalar array[],Vec *vv) I didn't find more information about the array from the manual. http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecCreateMPIWithArray.html Thanks a lot, Yujie -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -- next part -- An HTML attachment was scrubbed... URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120413/46e78e9f/attachment.htm
[petsc-users] about array in VecCreateMPIWithArray()
Thanks, Matt. If I have one array, each processor has a copy of all the values. one possible option is VecCreateMPI(); VecSetValues(); VecAssemblyBegin(); VecAssemblyEnd(); any better idea? if I have one array, only one processor has a copy of all the values. How to generate a MPI vector? Best, Yujie On Fri, Apr 13, 2012 at 10:38 AM, Matthew Knepley knepley at gmail.com wrote: On Fri, Apr 13, 2012 at 11:37 AM, recrusader recrusader at gmail.com wrote: Dear PETSc developers, my question is what type of array is need for VecCreateMPIWithArray? it is parallel distributed, that each processor holds local values of the array? or each processor has a copy of all the values of the array? Only local values. Matt PetscErrorCode VecCreateMPIWithArray(MPI_Comm comm,PetscInt n,PetscInt N,const PetscScalar array[],Vec *vv) I didn't find more information about the array from the manual. http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecCreateMPIWithArray.html Thanks a lot, Yujie -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -- next part -- An HTML attachment was scrubbed... URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120413/41cedc4b/attachment.htm
[petsc-users] about array in VecCreateMPIWithArray()
On Fri, Apr 13, 2012 at 11:59 AM, recrusader recrusader at gmail.com wrote: Thanks, Matt. If I have one array, each processor has a copy of all the values. one possible option is 1) If all processors have all values the code is already not scalable 2) If everyone has all values, only set the values you own Matt VecCreateMPI(); VecSetValues(); VecAssemblyBegin(); VecAssemblyEnd(); any better idea? if I have one array, only one processor has a copy of all the values. How to generate a MPI vector? Best, Yujie On Fri, Apr 13, 2012 at 10:38 AM, Matthew Knepley knepley at gmail.comwrote: On Fri, Apr 13, 2012 at 11:37 AM, recrusader recrusader at gmail.comwrote: Dear PETSc developers, my question is what type of array is need for VecCreateMPIWithArray? it is parallel distributed, that each processor holds local values of the array? or each processor has a copy of all the values of the array? Only local values. Matt PetscErrorCode VecCreateMPIWithArray(MPI_Comm comm,PetscInt n,PetscInt N,const PetscScalar array[],Vec *vv) I didn't find more information about the array from the manual. http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecCreateMPIWithArray.html Thanks a lot, Yujie -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -- next part -- An HTML attachment was scrubbed... URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120413/74e1b144/attachment.htm
[petsc-users] Petsc CMake conf
Hi, Are there any cmake conf file that I can include in my CMakeLists.txt that would automatically detect include/lib directory for my petsc installation? Right now I'm doing this manually and was wondering if its possibel to automate it. Thanks, Mohammad -- next part -- An HTML attachment was scrubbed... URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120413/afe50c61/attachment.htm
[petsc-users] Petsc CMake conf
On Fri, Apr 13, 2012 at 17:17, Mohammad Mirzadeh mirzadeh at gmail.com wrote: Hi, Are there any cmake conf file that I can include in my CMakeLists.txt that would automatically detect include/lib directory for my petsc installation? Right now I'm doing this manually and was wondering if its possibel to automate it. https://github.com/jedbrown/cmake-modules/blob/master/FindPETSc.cmake -- next part -- An HTML attachment was scrubbed... URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120413/3d85d788/attachment.htm
[petsc-users] A problem with MPI Derived Data Type and 'calloc'
Dear Dr. Brown, Your brilliant idea works. :) Thank you so much. I have a final question on it. Is it taken a lot of memory for doing this? As I understand, pointers won't occupy many memories and it works like an alias. It will not, to my limit knowledge, take much extra memory by doing this. Is that true? thanks, Alan On 4/12/2012 1:22 PM, Jed Brown wrote: On Thu, Apr 12, 2012 at 13:16, Zhenglun (Alan) Wei zhenglun.wei at gmail.com mailto:zhenglun.wei at gmail.com wrote: Thank you for your reply. It gives me another way to solve this problem. However, I failed several times while I was trying it. Can I repeat your idea to make sure that I understand it. 1) should define a new one-dimensional pointer array, i.e. TESTVAR *array; 2) I allocate this array with array = (TESTVAR*) calloc(SIZE*SIZE, sizeof(TESTVAR)); 3) then, I setup pointer of 'a[i][j]' to array. the_struct **a = malloc(SIZE*sizeof(the_struct)); for (i=0; iSIZE; i++) a = array[i*SIZE]; Now you can use a[i][j] instead of array[i*SIZE+j]. With C99, you can just create a VLA pointer: Scalar (*a)[SIZE] = (Scalar(*)[SIZE])array; and then use a[i][j] syntax without needing to allocate those pointers. It's a shame Microsoft refuses to do any maintenance on their old C compiler. Are they correct? BTW, does PETSc have any data structure can be an alternative so that I do not need to use MPI derived data type? You can use VecScatter, for example. -- next part -- An HTML attachment was scrubbed... URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120413/0c60869a/attachment.htm
[petsc-users] A problem with MPI Derived Data Type and 'calloc'
On Fri, Apr 13, 2012 at 17:38, Zhenglun (Alan) Wei zhenglun.wei at gmail.comwrote: I have a final question on it. Is it taken a lot of memory for doing this? As I understand, pointers won't occupy many memories and it works like an alias. It will not, to my limit knowledge, take much extra memory by doing this. A pointer takes about as much space as a floating point value, so that array of pointers costs about 1*N compared to the N*N matrix. -- next part -- An HTML attachment was scrubbed... URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120413/13427abf/attachment.htm
[petsc-users] Petsc CMake conf
Sweet :D -- Thanks Jed. Just a question though. When I run cmake in the build directory I get: -- Performing Test MULTIPASS_TEST_1_petsc_works_minimal -- Performing Test MULTIPASS_TEST_1_petsc_works_minimal - Failed -- Performing Test MULTIPASS_TEST_2_petsc_works_allincludes -- Performing Test MULTIPASS_TEST_2_petsc_works_allincludes - Failed -- Performing Test MULTIPASS_TEST_3_petsc_works_alllibraries -- Performing Test MULTIPASS_TEST_3_petsc_works_alllibraries - Failed -- Performing Test MULTIPASS_TEST_4_petsc_works_all -- Performing Test MULTIPASS_TEST_4_petsc_works_all - Failed -- PETSc could not be used, maybe the install is broken. -- PETSc could not be found. Be sure to set PETSC_DIR and PETSC_ARCH. (missing: PETSC_EXECUTABLE_RUNS) -- PETSc could not be found. Be sure to set PETSC_DIR and PETSC_ARCH. (missing: PETSC_EXECUTABLE_RUNS) But actually I can make and run the binary without any problem! should I ignore this? I do set PETSC_DIR and PETSC_ARCH in my CMakeLists.txt. On Fri, Apr 13, 2012 at 3:19 PM, Jed Brown jedbrown at mcs.anl.gov wrote: On Fri, Apr 13, 2012 at 17:17, Mohammad Mirzadeh mirzadeh at gmail.comwrote: Hi, Are there any cmake conf file that I can include in my CMakeLists.txt that would automatically detect include/lib directory for my petsc installation? Right now I'm doing this manually and was wondering if its possibel to automate it. https://github.com/jedbrown/cmake-modules/blob/master/FindPETSc.cmake -- next part -- An HTML attachment was scrubbed... URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120413/c60a9cc5/attachment.htm
[petsc-users] Petsc CMake conf
On Fri, Apr 13, 2012 at 17:47, Mohammad Mirzadeh mirzadeh at gmail.com wrote: ust a question though. When I run cmake in the build directory I get: -- Performing Test MULTIPASS_TEST_1_petsc_works_minimal -- Performing Test MULTIPASS_TEST_1_petsc_works_minimal - Failed -- Performing Test MULTIPASS_TEST_2_petsc_works_allincludes -- Performing Test MULTIPASS_TEST_2_petsc_works_allincludes - Failed -- Performing Test MULTIPASS_TEST_3_petsc_works_alllibraries -- Performing Test MULTIPASS_TEST_3_petsc_works_alllibraries - Failed -- Performing Test MULTIPASS_TEST_4_petsc_works_all -- Performing Test MULTIPASS_TEST_4_petsc_works_all - Failed -- PETSc could not be used, maybe the install is broken. -- PETSc could not be found. Be sure to set PETSC_DIR and PETSC_ARCH. (missing: PETSC_EXECUTABLE_RUNS) -- PETSc could not be found. Be sure to set PETSC_DIR and PETSC_ARCH. (missing: PETSC_EXECUTABLE_RUNS) But actually I can make and run the binary without any problem! should I ignore this? I do set PETSC_DIR and PETSC_ARCH in my CMakeLists.txt. Which binary runs? Check the CMake error files and use cmake --trace or --debug-output. -- next part -- An HTML attachment was scrubbed... URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120413/46ab8017/attachment.htm
[petsc-users] Petsc CMake conf
On Fri, Apr 13, 2012 at 17:57, Mohammad Mirzadeh mirzadeh at gmail.com wrote: my code -- I'm experimenting with CMake to manage my project and link it to petsc. right now, it seems to link to petsc correctly and I can run the code just fine. It just produces those messages when generating the makefile. Feel free to investigate why it was failing and let me know or send a patch. It shouldn't be hard to figure out from the logs. -- next part -- An HTML attachment was scrubbed... URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120413/3606fc64/attachment.htm
[petsc-users] Petsc CMake conf
Sure. Will let you know if I found something. Once again thanks. One of the best things about PETSc is the community -- You don't see this often in other packages :) On Fri, Apr 13, 2012 at 4:01 PM, Jed Brown jedbrown at mcs.anl.gov wrote: On Fri, Apr 13, 2012 at 17:57, Mohammad Mirzadeh mirzadeh at gmail.comwrote: my code -- I'm experimenting with CMake to manage my project and link it to petsc. right now, it seems to link to petsc correctly and I can run the code just fine. It just produces those messages when generating the makefile. Feel free to investigate why it was failing and let me know or send a patch. It shouldn't be hard to figure out from the logs. -- next part -- An HTML attachment was scrubbed... URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120413/beb92454/attachment.htm
[petsc-users] ksp_monitor_true_residual_norm
In using ksp_monitor_true_residual_norm, is it possible to change how often this information is printed out? That is, instead of every iteration, say I only want to see it every 10 or 20 iterations. Is there an easy way to do this, other than creating my own monitor and doing it myself? Thanks, Randy M.
[petsc-users] ksp_monitor_true_residual_norm
Write a one line monitor that calls the true residual monitor when desired: PetscErrorCode myKSPMonitorTrueResidualNorm(KSP ksp,PetscInt n,PetscReal rnorm,void *dummy) { if (n % 10) { ierr = KSPMonitorTrueResidualNorm(ksp,n,rnorm,dummy);CHKERRQ(ierr); } } then call this on the KPS ierr = KSPMonitorSet(ksp,myKSPMonitorTrueResidualNorm,PETSC_VIEWER_STDOUT,0);CHKERRQ(ierr); On Apr 13, 2012, at 6:52 PM, Randall Mackie wrote: In using ksp_monitor_true_residual_norm, is it possible to change how often this information is printed out? That is, instead of every iteration, say I only want to see it every 10 or 20 iterations. Is there an easy way to do this, other than creating my own monitor and doing it myself? Thanks, Randy M.