Re: [petsc-users] Using edge-weights for partitioning

2020-08-30 Thread Eda Oktay
Okay, thank you so much!

Eda

On Sun, Aug 30, 2020, 9:36 PM Jose E. Roman  wrote:

> The user interface of Chaco includes an argument for edge weights (don't
> know which methods within Chaco take them into account). The original PETSc
> wrapper to Chaco was developed by a student of mine (together with Scotch,
> Party and Jostle) at around 2003. At that time, MatPartitioning only had
> support for vertex weights (edge weight support has been introduced very
> recently), so we just passed a NULL in this argument.
>
> Jose
>
>
> > El 30 ago 2020, a las 16:35, Barry Smith  escribió:
> >
> >
> >
> >> On Aug 30, 2020, at 2:57 AM, Eda Oktay  wrote:
> >>
> >> Dear Matt,
> >>
> >> First of all I figured out that I asked wrongly. It's not ParMETIS
> giving the same result. It is CHACO. ParMETIS gives different results when
> I use edge weights.
> >>
> >> Thanks!
> >>
> >> Dear Barry,
> >>
> >> I am trying to partition the matrix to compare the edge cuts when it is
> partitioned with CHACO, ParMETIS and the spectral partitioning algorithm
> with the k-means clustering (I wrote this code in PETSc).  In the end, I
> will conclude that if a linear system is to be solved and the coefficient
> matrix is large in size, then partitioning the coefficient matrix by using
> one of these algorithms will help one to solve the linear system faster and
> with small communication.
> >>
> >> What is forcing matrix to have all positive values? Isn't it done by
> using MatPartitioningGetUseEdgeWeights and MatPartitioningSetUseEdgeWeights?
> >>
> >> I will send the test case but I am already passing my original matrix
> directly to SetAdjacency (SymmA is my symmetric matrix with positive
> values):
> >>
> >>   ierr =
> MatConvert(SymmA,MATMPIADJ,MAT_INITIAL_MATRIX,);CHKERRQ(ierr);
>
> >>   ierr = MatPartitioningCreate(MPI_COMM_WORLD,);CHKERRQ(ierr);
> >>   ierr = MatPartitioningSetAdjacency(part,AL);CHKERRQ(ierr);
> >>ierr = MatPartitioningSetFromOptions(part);CHKERRQ(ierr);
> >
> >   You should not need this. Just
> >
> > ierr = MatPartitioningCreate(MPI_COMM_WORLD,);CHKERRQ(ierr);
> > ierr = MatPartitioningSetAdjacency(part,SymmA);CHKERRQ(ierr);
> > ierr = MatPartitioningSetFromOptions(part);CHKERRQ(ierr);
> >
> >
> >   MatPartitioningSetAdjacency takes any MatType directly.
> >
> >
> >>
> >> So, if ParMETIS gives different edge cut as it is expected,
> MatPartitioningGetUseEdgeWeights and MatPartitioningSetUseEdgeWeights works
> correctly. Why can't CHACO?
> >>
> >> Thanks!
> >>
> >> Eda
> >>
> >> Barry Smith , 30 Ağu 2020 Paz, 03:00 tarihinde şunu
> yazdı:
> >>
> >>
> >> > On Aug 29, 2020, at 2:23 PM, Eda Oktay  wrote:
> >> >
> >> > Hi all,
> >> >
> >> > I am trying to partition a sparse matrix by using ParMETIS. I am
> converting my matrix to adjacency type and then applying partitioning.
> >>
> >>  You don't need to do this. Just pass your original matrix directly
> into MatPartitioningSetAdjacency() it will handle any conversions needed.
> >>
> >>  Edge weights need to be positive, since they represent how much
> communication is to take place over that link. You may need to force your
> matrix to have all positive values before giving it to
> MatPartitioningSetAdjacency and using edge weights.
> >>
> >>   I this doesn't work than our code is broken, please send us a simple
> test case
> >>
> >>   Question: Why are you partitioning a matrix? Is it for load balancing
> of solves or matrix vector products with the matrix? To reduce interprocess
> communication during solves or matrix vector products with the matrix? If
> so the numerical values in the matrix don't affect load balance or
> interprocess communication for these operations.
> >>
> >>
> >>   Barry
> >>
> >>
> >>
> >>
> >> > Default, I understood that partitioning doesn't use edge-weights.
> However, when I used the following codes I saw from ex15 and used
> "-test_use_edge_weights 1", I am getting the same results as when I don't
> consider edge weights.
> >> >
> >> > PetscBool use_edge_weights=PETSC_FALSE;
> >> >
>  
> PetscOptionsGetBool(NULL,NULL,"-test_use_edge_weights",_edge_weights,NULL);
> >> >   if (use_edge_weights) {
> >> >   MatPartitioningSetUseEdgeWeights(part,use_edge_

Re: [petsc-users] Using edge-weights for partitioning

2020-08-30 Thread Eda Oktay
Okay thank you so much!

Mark Adams , 30 Ağu 2020 Paz, 15:34 tarihinde şunu yazdı:

>
>>
>>
>> So, if ParMETIS gives different edge cut as it is expected,
>> MatPartitioningGetUseEdgeWeights and MatPartitioningSetUseEdgeWeights works
>> correctly. Why can't CHACO?
>>
>>>
>>>
> Chaco does not support using edge weights.
>
>


Re: [petsc-users] Using edge-weights for partitioning

2020-08-30 Thread Eda Oktay
Dear Barry,

I attached test code and a small binary matrix whose elements are less than
10 which you can use to test. In the code, as an output, the index set
"partitioning" will be given. As you will see, when ParMETIS is used, index
set changes when edge weights are used, whereas when the option changes to
chaco, index set remains the same.

Thanks!

Eda

Eda Oktay , 30 Ağu 2020 Paz, 11:05 tarihinde şunu
yazdı:

> And is edge weights being less than 10 still valid? Although I am not
> getting any errors, when the elements in my matrix are larger than 10, even
> ParMETIS doesn't give different results.
>
> Eda Oktay , 30 Ağu 2020 Paz, 10:57 tarihinde şunu
> yazdı:
>
>> Dear Matt,
>>
>> First of all I figured out that I asked wrongly. It's not ParMETIS giving
>> the same result. It is CHACO. ParMETIS gives different results when I use
>> edge weights.
>>
>> Thanks!
>>
>> Dear Barry,
>>
>> I am trying to partition the matrix to compare the edge cuts when it is
>> partitioned with CHACO, ParMETIS and the spectral partitioning algorithm
>> with the k-means clustering (I wrote this code in PETSc).  In the end, I
>> will conclude that if a linear system is to be solved and the coefficient
>> matrix is large in size, then partitioning the coefficient matrix by using
>> one of these algorithms will help one to solve the linear system faster and
>> with small communication.
>>
>> What is forcing matrix to have all positive values? Isn't it done by
>> using MatPartitioningGetUseEdgeWeights and MatPartitioningSetUseEdgeWeights?
>>
>> I will send the test case but I am already passing my original matrix
>> directly to SetAdjacency (SymmA is my symmetric matrix with positive
>> values):
>>
>>   ierr =
>> MatConvert(SymmA,MATMPIADJ,MAT_INITIAL_MATRIX,);CHKERRQ(ierr);
>>
>>   ierr = MatPartitioningCreate(MPI_COMM_WORLD,);CHKERRQ(ierr);
>>   ierr = MatPartitioningSetAdjacency(part,AL);CHKERRQ(ierr);
>>ierr = MatPartitioningSetFromOptions(part);CHKERRQ(ierr);
>>
>> So, if ParMETIS gives different edge cut as it is expected,
>> MatPartitioningGetUseEdgeWeights and MatPartitioningSetUseEdgeWeights works
>> correctly. Why can't CHACO?
>>
>> Thanks!
>>
>> Eda
>>
>> Barry Smith , 30 Ağu 2020 Paz, 03:00 tarihinde şunu
>> yazdı:
>>
>>>
>>>
>>> > On Aug 29, 2020, at 2:23 PM, Eda Oktay  wrote:
>>> >
>>> > Hi all,
>>> >
>>> > I am trying to partition a sparse matrix by using ParMETIS. I am
>>> converting my matrix to adjacency type and then applying partitioning.
>>>
>>>  You don't need to do this. Just pass your original matrix directly into
>>> MatPartitioningSetAdjacency() it will handle any conversions needed.
>>>
>>>  Edge weights need to be positive, since they represent how much
>>> communication is to take place over that link. You may need to force your
>>> matrix to have all positive values before giving it to
>>> MatPartitioningSetAdjacency and using edge weights.
>>>
>>>   I this doesn't work than our code is broken, please send us a simple
>>> test case
>>>
>>>   Question: Why are you partitioning a matrix? Is it for load balancing
>>> of solves or matrix vector products with the matrix? To reduce interprocess
>>> communication during solves or matrix vector products with the matrix? If
>>> so the numerical values in the matrix don't affect load balance or
>>> interprocess communication for these operations.
>>>
>>>
>>>   Barry
>>>
>>>
>>>
>>>
>>> > Default, I understood that partitioning doesn't use edge-weights.
>>> However, when I used the following codes I saw from ex15 and used
>>> "-test_use_edge_weights 1", I am getting the same results as when I don't
>>> consider edge weights.
>>> >
>>> > PetscBool use_edge_weights=PETSC_FALSE;
>>> >
>>>  
>>> PetscOptionsGetBool(NULL,NULL,"-test_use_edge_weights",_edge_weights,NULL);
>>> >   if (use_edge_weights) {
>>> >   MatPartitioningSetUseEdgeWeights(part,use_edge_weights);
>>> >
>>> >   MatPartitioningGetUseEdgeWeights(part,_edge_weights);
>>> >   if (!use_edge_weights)
>>> SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP, "use_edge_weights flag does
>>> not setup correctly \n");
>>> > }
>>> >
>>> > My matrix does not consist of 1s and 0s, so I want partitioning to
>>> consider all the nonzero elements in the matrix as edge weights. Don't
>>> MatPartitioningSetUseEdgeWeights and MatPartitioningGetUseEdgeWeights do
>>> that? Should I add something more? In the page of
>>> MatPartitioningSetUseEdgeWeights, it is written that "If set
>>> use_edge_weights to TRUE, users need to make sure legal edge weights are
>>> stored in an ADJ matrix.". How can I make sure of this?
>>> >
>>> > I am trying to compare the use of ParMETIS with the spectral
>>> partitioning algorithm when I used a weighted Laplacian.
>>> >
>>> > Thanks!
>>> >
>>> > Eda
>>> >
>>>
>>>
<>


Re: [petsc-users] Using edge-weights for partitioning

2020-08-30 Thread Eda Oktay
And is edge weights being less than 10 still valid? Although I am not
getting any errors, when the elements in my matrix are larger than 10, even
ParMETIS doesn't give different results.

Eda Oktay , 30 Ağu 2020 Paz, 10:57 tarihinde şunu
yazdı:

> Dear Matt,
>
> First of all I figured out that I asked wrongly. It's not ParMETIS giving
> the same result. It is CHACO. ParMETIS gives different results when I use
> edge weights.
>
> Thanks!
>
> Dear Barry,
>
> I am trying to partition the matrix to compare the edge cuts when it is
> partitioned with CHACO, ParMETIS and the spectral partitioning algorithm
> with the k-means clustering (I wrote this code in PETSc).  In the end, I
> will conclude that if a linear system is to be solved and the coefficient
> matrix is large in size, then partitioning the coefficient matrix by using
> one of these algorithms will help one to solve the linear system faster and
> with small communication.
>
> What is forcing matrix to have all positive values? Isn't it done by using
> MatPartitioningGetUseEdgeWeights and MatPartitioningSetUseEdgeWeights?
>
> I will send the test case but I am already passing my original matrix
> directly to SetAdjacency (SymmA is my symmetric matrix with positive
> values):
>
>   ierr = MatConvert(SymmA,MATMPIADJ,MAT_INITIAL_MATRIX,);CHKERRQ(ierr);
>
>   ierr = MatPartitioningCreate(MPI_COMM_WORLD,);CHKERRQ(ierr);
>   ierr = MatPartitioningSetAdjacency(part,AL);CHKERRQ(ierr);
>ierr = MatPartitioningSetFromOptions(part);CHKERRQ(ierr);
>
> So, if ParMETIS gives different edge cut as it is expected,
> MatPartitioningGetUseEdgeWeights and MatPartitioningSetUseEdgeWeights works
> correctly. Why can't CHACO?
>
> Thanks!
>
> Eda
>
> Barry Smith , 30 Ağu 2020 Paz, 03:00 tarihinde şunu
> yazdı:
>
>>
>>
>> > On Aug 29, 2020, at 2:23 PM, Eda Oktay  wrote:
>> >
>> > Hi all,
>> >
>> > I am trying to partition a sparse matrix by using ParMETIS. I am
>> converting my matrix to adjacency type and then applying partitioning.
>>
>>  You don't need to do this. Just pass your original matrix directly into
>> MatPartitioningSetAdjacency() it will handle any conversions needed.
>>
>>  Edge weights need to be positive, since they represent how much
>> communication is to take place over that link. You may need to force your
>> matrix to have all positive values before giving it to
>> MatPartitioningSetAdjacency and using edge weights.
>>
>>   I this doesn't work than our code is broken, please send us a simple
>> test case
>>
>>   Question: Why are you partitioning a matrix? Is it for load balancing
>> of solves or matrix vector products with the matrix? To reduce interprocess
>> communication during solves or matrix vector products with the matrix? If
>> so the numerical values in the matrix don't affect load balance or
>> interprocess communication for these operations.
>>
>>
>>   Barry
>>
>>
>>
>>
>> > Default, I understood that partitioning doesn't use edge-weights.
>> However, when I used the following codes I saw from ex15 and used
>> "-test_use_edge_weights 1", I am getting the same results as when I don't
>> consider edge weights.
>> >
>> > PetscBool use_edge_weights=PETSC_FALSE;
>> >
>>  
>> PetscOptionsGetBool(NULL,NULL,"-test_use_edge_weights",_edge_weights,NULL);
>> >   if (use_edge_weights) {
>> >   MatPartitioningSetUseEdgeWeights(part,use_edge_weights);
>> >
>> >   MatPartitioningGetUseEdgeWeights(part,_edge_weights);
>> >   if (!use_edge_weights)
>> SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP, "use_edge_weights flag does
>> not setup correctly \n");
>> > }
>> >
>> > My matrix does not consist of 1s and 0s, so I want partitioning to
>> consider all the nonzero elements in the matrix as edge weights. Don't
>> MatPartitioningSetUseEdgeWeights and MatPartitioningGetUseEdgeWeights do
>> that? Should I add something more? In the page of
>> MatPartitioningSetUseEdgeWeights, it is written that "If set
>> use_edge_weights to TRUE, users need to make sure legal edge weights are
>> stored in an ADJ matrix.". How can I make sure of this?
>> >
>> > I am trying to compare the use of ParMETIS with the spectral
>> partitioning algorithm when I used a weighted Laplacian.
>> >
>> > Thanks!
>> >
>> > Eda
>> >
>>
>>


Re: [petsc-users] Using edge-weights for partitioning

2020-08-30 Thread Eda Oktay
Dear Matt,

First of all I figured out that I asked wrongly. It's not ParMETIS giving
the same result. It is CHACO. ParMETIS gives different results when I use
edge weights.

Thanks!

Dear Barry,

I am trying to partition the matrix to compare the edge cuts when it is
partitioned with CHACO, ParMETIS and the spectral partitioning algorithm
with the k-means clustering (I wrote this code in PETSc).  In the end, I
will conclude that if a linear system is to be solved and the coefficient
matrix is large in size, then partitioning the coefficient matrix by using
one of these algorithms will help one to solve the linear system faster and
with small communication.

What is forcing matrix to have all positive values? Isn't it done by using
MatPartitioningGetUseEdgeWeights and MatPartitioningSetUseEdgeWeights?

I will send the test case but I am already passing my original matrix
directly to SetAdjacency (SymmA is my symmetric matrix with positive
values):

  ierr = MatConvert(SymmA,MATMPIADJ,MAT_INITIAL_MATRIX,);CHKERRQ(ierr);

  ierr = MatPartitioningCreate(MPI_COMM_WORLD,);CHKERRQ(ierr);
  ierr = MatPartitioningSetAdjacency(part,AL);CHKERRQ(ierr);
   ierr = MatPartitioningSetFromOptions(part);CHKERRQ(ierr);

So, if ParMETIS gives different edge cut as it is expected,
MatPartitioningGetUseEdgeWeights and MatPartitioningSetUseEdgeWeights works
correctly. Why can't CHACO?

Thanks!

Eda

Barry Smith , 30 Ağu 2020 Paz, 03:00 tarihinde şunu yazdı:

>
>
> > On Aug 29, 2020, at 2:23 PM, Eda Oktay  wrote:
> >
> > Hi all,
> >
> > I am trying to partition a sparse matrix by using ParMETIS. I am
> converting my matrix to adjacency type and then applying partitioning.
>
>  You don't need to do this. Just pass your original matrix directly into
> MatPartitioningSetAdjacency() it will handle any conversions needed.
>
>  Edge weights need to be positive, since they represent how much
> communication is to take place over that link. You may need to force your
> matrix to have all positive values before giving it to
> MatPartitioningSetAdjacency and using edge weights.
>
>   I this doesn't work than our code is broken, please send us a simple
> test case
>
>   Question: Why are you partitioning a matrix? Is it for load balancing of
> solves or matrix vector products with the matrix? To reduce interprocess
> communication during solves or matrix vector products with the matrix? If
> so the numerical values in the matrix don't affect load balance or
> interprocess communication for these operations.
>
>
>   Barry
>
>
>
>
> > Default, I understood that partitioning doesn't use edge-weights.
> However, when I used the following codes I saw from ex15 and used
> "-test_use_edge_weights 1", I am getting the same results as when I don't
> consider edge weights.
> >
> > PetscBool use_edge_weights=PETSC_FALSE;
> >
>  
> PetscOptionsGetBool(NULL,NULL,"-test_use_edge_weights",_edge_weights,NULL);
> >   if (use_edge_weights) {
> >   MatPartitioningSetUseEdgeWeights(part,use_edge_weights);
> >
> >   MatPartitioningGetUseEdgeWeights(part,_edge_weights);
> >   if (!use_edge_weights)
> SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP, "use_edge_weights flag does
> not setup correctly \n");
> > }
> >
> > My matrix does not consist of 1s and 0s, so I want partitioning to
> consider all the nonzero elements in the matrix as edge weights. Don't
> MatPartitioningSetUseEdgeWeights and MatPartitioningGetUseEdgeWeights do
> that? Should I add something more? In the page of
> MatPartitioningSetUseEdgeWeights, it is written that "If set
> use_edge_weights to TRUE, users need to make sure legal edge weights are
> stored in an ADJ matrix.". How can I make sure of this?
> >
> > I am trying to compare the use of ParMETIS with the spectral
> partitioning algorithm when I used a weighted Laplacian.
> >
> > Thanks!
> >
> > Eda
> >
>
>


[petsc-users] Using edge-weights for partitioning

2020-08-29 Thread Eda Oktay
Hi all,

I am trying to partition a sparse matrix by using ParMETIS. I am converting
my matrix to adjacency type and then applying partitioning. Default, I
understood that partitioning doesn't use edge-weights. However, when I used
the following codes I saw from ex15 and used "-test_use_edge_weights 1", I
am getting the same results as when I don't consider edge weights.

PetscBool use_edge_weights=PETSC_FALSE;

PetscOptionsGetBool(NULL,NULL,"-test_use_edge_weights",_edge_weights,NULL);
  if (use_edge_weights) {
  MatPartitioningSetUseEdgeWeights(part,use_edge_weights);

  MatPartitioningGetUseEdgeWeights(part,_edge_weights);
  if (!use_edge_weights) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,
"use_edge_weights flag does not setup correctly \n");
}

My matrix does not consist of 1s and 0s, so I want partitioning to consider
all the nonzero elements in the matrix as edge weights. Don't
MatPartitioningSetUseEdgeWeights and MatPartitioningGetUseEdgeWeights do
that? Should I add something more? In the page
of MatPartitioningSetUseEdgeWeights, it is written that "If set
use_edge_weights to TRUE, users need to make sure legal edge weights are
stored in an ADJ matrix.". How can I make sure of this?

I am trying to compare the use of ParMETIS with the spectral partitioning
algorithm when I used a weighted Laplacian.

Thanks!

Eda


Re: [petsc-users] ParMETIS vs. CHACO when no partitioning is made

2020-08-14 Thread Eda Oktay
Dear Barry,

Thank you for answering. I am sending a sample code and a binary file.

Thanks!

Eda

Barry Smith , 14 Ağu 2020 Cum, 18:49 tarihinde şunu yazdı:

>
>Could be a bug in Chaco or its call from PETSc for the special case of
> one process. Could you send a sample code that demonstrates the problem?
>
>   Barry
>
>
> > On Aug 14, 2020, at 8:53 AM, Eda Oktay  wrote:
> >
> > Hi all,
> >
> > I am trying to try something. I am using the same MatPartitioning codes
> for both CHACO and ParMETIS:
> >
> > ierr =
> MatConvert(SymmA,MATMPIADJ,MAT_INITIAL_MATRIX,);CHKERRQ(ierr);
> >   ierr = MatPartitioningCreate(MPI_COMM_WORLD,);CHKERRQ(ierr);
> >   ierr = MatPartitioningSetAdjacency(part,AL);CHKERRQ(ierr);
> >
> >   ierr = MatPartitioningSetFromOptions(part);CHKERRQ(ierr);
> >   ierr = MatPartitioningApply(part,);CHKERRQ(ierr);
> >
> > After obtaining the IS, I apply this to my original nonsymmetric matrix
> and try to get an approximate edge cut.
> >
> > Except for 1 partitioning, my program completely works for 2,4 and 16
> partitionings. However, for 1, ParMETIS gives results where CHACO I guess
> doesn't since I am getting errors about the index set.
> >
> > What is the difference between CHACO and ParMETIS that one works for 1
> partitioning and one doesn't?
> >
> > Thanks!
> >
> > Eda
>
>
<>


[petsc-users] ParMETIS vs. CHACO when no partitioning is made

2020-08-14 Thread Eda Oktay
Hi all,

I am trying to try something. I am using the same MatPartitioning codes for
both CHACO and ParMETIS:

ierr = MatConvert(SymmA,MATMPIADJ,MAT_INITIAL_MATRIX,);CHKERRQ(ierr);
  ierr = MatPartitioningCreate(MPI_COMM_WORLD,);CHKERRQ(ierr);
  ierr = MatPartitioningSetAdjacency(part,AL);CHKERRQ(ierr);

  ierr = MatPartitioningSetFromOptions(part);CHKERRQ(ierr);
  ierr = MatPartitioningApply(part,);CHKERRQ(ierr);

After obtaining the IS, I apply this to my original nonsymmetric matrix and
try to get an approximate edge cut.

Except for 1 partitioning, my program completely works for 2,4 and 16
partitionings. However, for 1, ParMETIS gives results where CHACO I guess
doesn't since I am getting errors about the index set.

What is the difference between CHACO and ParMETIS that one works for 1
partitioning and one doesn't?

Thanks!

Eda


Re: [petsc-users] PETSc Make error

2020-07-31 Thread Eda Oktay
Dear Satish,

I configured petsc-3.13.2. Is this still the same problem?

Thanks!

Eda

On Fri, Jul 31, 2020, 10:50 AM Satish Balay  wrote:

>
> >>>>>>>>
>   File "./config/gmakegen.py", line 4, in 
> from distutils.sysconfig import parse_makefile
> ModuleNotFoundError: No module named 'distutils.sysconfig'
> <<<<<
>
> For one - if you used petsc-3.13.3 - it would have also tried python2 - or
> given a reasonable error message.
>
> If you have python2 - you can try:
>
> python2 ./configure ...
>
> Or you can ask sysadmin on this machine to install python3-distutils or
> equivalent package.
>
> Satish
>
> On Fri, 31 Jul 2020, Eda Oktay wrote:
>
> > Hi all,
> >
> > I configured petsc-3.13.2 with following options:
> >
> > ./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran
> > --download-mpich --download-openblas --download-metis
> > --download-parmetis --download-chaco --download-slepc --with-X=1
> >
> > However, I got a make error.
> >
> > I attached make.log and configure.log, how can I fix that problem?
> >
> > Thanks!
> >
> > Eda
> >
>
>


Re: [petsc-users] Petsc configure error (cmake)

2020-07-31 Thread Eda Oktay
Dear all,

I made administrator of the server download cmake and configured it
again and it was successful.

Thank you so much for your replies!

Eda

Satish Balay , 29 Tem 2020 Çar, 20:20 tarihinde şunu yazdı:
>
> This is likely a cmake install bug. I submitted a report.
>
> https://gitlab.kitware.com/cmake/cmake/-/issues/21035
>
> The workaround is to have make in PATH. Attaching this patch.
>
> And updating barry/2020-07-28/cmake-use-make-if-given/maint and 
> https://gitlab.com/petsc/petsc/-/merge_requests/3004 with this change.
>
> Satish
>
> On Wed, 29 Jul 2020, Satish Balay via petsc-users wrote:
>
> > I can reproduce this - by uninstalling system make.
> >
> > Will check.
> >
> > Satish
> >
> > On Wed, 29 Jul 2020, Eda Oktay wrote:
> >
> > > Dear Barry,
> > >
> > > I am afraid I am still getting the same error.
> > >
> > > Thanks,
> > >
> > > Eda
> > >
> > > Barry Smith , 29 Tem 2020 Çar, 18:51 tarihinde şunu 
> > > yazdı:
> > > >
> > > >
> > > >   Please try
> > > >
> > > >   rm -rf  /home/eda/petsc-3.13.2/arch-linux-c-debug
> > > >
> > > >   and then run configure again.
> > > >
> > > >   It lists the correct make to use
> > > >
> > > > Makefile processor on this system is: 
> > > > /home/eda/petsc-3.13.2/arch-linux-c-debug/bin/make
> > > >
> > > >   So I am hoping the problem is from the crazy cmake caching nonsense 
> > > > and cleaning out the old files will resolve the problem.
> > > >
> > > >   Barry
> > > >
> > > >
> > > > > On Jul 29, 2020, at 5:51 AM, Eda Oktay  wrote:
> > > > >
> > > > > Dear Barry,
> > > > >
> > > > > I wrote the followings:
> > > > >
> > > > > $ patch -p1 < cmakemake.patch
> > > > >
> > > > > And it gave the following line:
> > > > >
> > > > > (Stripping trailing CRs from patch; use --binary to disable.)
> > > > > patching file config/BuildSystem/config/packages/cmake.py
> > > > >
> > > > > Then I configured as follows:
> > > > >
> > > > > ./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran
> > > > > --download-make --download-mpich --download-openblas --download-metis
> > > > > --download-parmetis --download-chaco
> > > > > --download-slepc=/home/eda/slepc-v3.13.2.tar.gz --download-cmake
> > > > > --with-X=1
> > > > >
> > > > > But I am still getting the following error:
> > > > >
> > > > > ***
> > > > > UNABLE to CONFIGURE with GIVEN OPTIONS(see configure.log
> > > > > for details):
> > > > > ---
> > > > > Error running configure on CMAKE
> > > > > ***
> > > > >
> > > > > Am I doing something wrong?
> > > > >
> > > > > Thanks!
> > > > >
> > > > > Eda
> > > > >
> > > > > Barry Smith , 29 Tem 2020 Çar, 00:10 tarihinde şunu 
> > > > > yazdı:
> > > > >>
> > > > >>
> > > > >>   It's better to use git than download tarballs. With tarballs it is 
> > > > >> not possible to access recent fixes or try branches.
> > > > >>
> > > > >>   Here is what you can do, save the attachment as cmakemake.patch 
> > > > >> and do
> > > > >>
> > > > >>   patch -p1 < cmakemake.patch
> > > > >>
> > > > >>   in the PETSc directory
> > > > >>
> > > > >>   Then run configure as before
> > > > >>
> > > > >>   Barry
> > > > >>
> > > > >>
> > > > >>
> > > > >>> On Jul 28, 2020, at 3:28 PM, Eda Oktay  
> > > > >>> wrote:
> > > > >>>
> > > > >>> Dear Barry,
> > > > >>>
> > > > >>> Thank you so much for answering. So, I downloaded the tar.gz file 

Re: [petsc-users] Configuration error during OpenBLAS

2020-07-31 Thread Eda Oktay
Dear Satish,

Thank you so much for your replies. I installed git and I was able to
configure PETSc.

Thanks again!

Eda

Satish Balay , 30 Tem 2020 Per, 18:32 tarihinde şunu yazdı:
>
> On Thu, 30 Jul 2020, Eda Oktay wrote:
>
> > Dear Satish,
> >
> > I am sorry but I couldn't understand what should I do. Am I getting this
> > error because of case insensitivity?
>
> Its a bug in configure. I sent the fix [diff - 2 different fixes, you can try 
> any one of them] in a different reply.
>
> >
> > If I am, why now? I mean I configured Petsc with exact same options before
> > in 2 machines. What can be the reason?
>
> Likely you have git installed on the other 2 machines - so this issue didn't 
> come up. Without git - a tarball gets used, this issue is with tarball usage.
>
> [or if don't have git on these machines as well - they likely have case 
> insensitive file system - aka MacOS]
>
> Satish


Re: [petsc-users] Configuration error during OpenBLAS

2020-07-30 Thread Eda Oktay
Dear Satish,

I am sorry but I couldn't understand what should I do. Am I getting this
error because of case insensitivity?

If I am, why now? I mean I configured Petsc with exact same options before
in 2 machines. What can be the reason?

Thanks!

Eda

On Thu, Jul 30, 2020, 6:21 PM Satish Balay via petsc-users <
petsc-users@mcs.anl.gov> wrote:

> Generally we recommend using system blas/lapack
>
> Wrt: Blis - the usage is slightly complicated. It needs additional lapack
>
> So I think - if using blis - the following 2 modes might work
>
> --download-blis --download-f2cblaslapack
> --download-blis [system lapack]
>
> Satish
>
> On Thu, 30 Jul 2020, Victor Eijkhout wrote:
>
> >
> >
> > On , 2020Jul30, at 07:17, Matthew Knepley  knep...@gmail.com>> wrote:
> >
> > Shouldn't we be
> >
> > Be recommending Blis instead of OpenBlas?
> >
> > Victor.
> >
> >
>
>


Re: [petsc-users] Petsc configure error (cmake)

2020-07-28 Thread Eda Oktay
Dear Barry,

Thank you so much for answering. So, I downloaded the tar.gz file and
now, should I configure this file with my previous options?  I am
using the following line:

./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran
--download-make --download-mpich --download-openblas --download-metis
--download-parmetis --download-chaco
--download-slepc=/home/eda/slepc-v3.13.2.tar.gz --download-cmake
--with-X=1

Thanks so much again!

Eda

Barry Smith , 28 Tem 2020 Sal, 20:55 tarihinde şunu yazdı:
>
>
>Eda,
>
>  The branch barry/2020-07-28/cmake-use-make-if-given/maint should resolve 
> the problem. It will force the cmake build to use the make obtained with 
> --download-make
>
>Barry
>
>
> On Jul 28, 2020, at 9:48 AM, Matthew Knepley  wrote:
>
> On Tue, Jul 28, 2020 at 10:45 AM Eda Oktay  wrote:
>>
>> I am trying to download Petsc with slepc,openblas,mpich,meti,parmetis
>> and chaco to a linux computer (probably
>> ubuntu, I don't know because I am using it via ssh).
>>
>> Due to an error, for metis, I needed to download cmake, so I added
>> this option, too. However, I got an error telling me that "Error
>> running configure on cmake". I attached configure.log.
>>
>> What should I do? Where is the problem and how can ı fix it?
>>
>> Thank you so much for answering,
>
>
> It looks like you do not have 'make' in your path, and CMake is feaking out:
>
> CMAKE was just downloaded, forcing a rebuild because cannot determine if 
> package has changed
> 
> ===
>   Running configure on CMAKE; this may take 
> several minutes
> 
> ===
>
> Running Executable WITHOUT threads to time it out
> Executing: ./configure --prefix=/home/eda/petsc-3.13.2/arch-linux-c-debug 
> --parallel=40
> stdout:
> -
> CMake 3.15.6, Copyright 2000-2019 Kitware, Inc. and Contributors
> Found GNU toolchain
> C compiler on this system is: gcc
> C++ compiler on this system is: g++
> -
> Error when bootstrapping CMake:
> Cannot find appropriate Makefile processor on this system.
> Please specify one using environment variable MAKE.
> -
> Log of errors: 
> /home/eda/petsc-3.13.2/arch-linux-c-debug/externalpackages/cmake-3.15.6/Bootstrap.cmk/cmake_bootstrap.log
> -
>
>   Thanks,
>
> Matt
>
>>
>> Eda
>
>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/
>
>


Re: [petsc-users] SLEPc download error

2020-07-28 Thread Eda Oktay
Thanks so much!

Eda

Satish Balay , 28 Tem 2020 Sal, 04:46 tarihinde şunu yazdı:
>
> [balay@pj01 petsc]$ curl -O 
> https://gitlab.com/slepc/slepc/-/archive/v3.13.3/slepc-v3.13.3.tar.gz
>   % Total% Received % Xferd  Average Speed   TimeTime Time  
> Current
>  Dload  Upload   Total   SpentLeft  Speed
> 100 1253k0 1253k0 0  16.1M  0 --:--:-- --:--:-- --:--:-- 16.1M
> [balay@pj01 petsc]$ file slepc-v3.13.3.tar.gz
> slepc-v3.13.3.tar.gz: gzip compressed data, from Unix, original size modulo 
> 2^32 7690240
> [balay@pj01 petsc]$ python
> Python 3.7.7 (default, Jun  4 2020, 15:43:14)
> [GCC 9.3.1 20200408 (Red Hat 9.3.1-2)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from urllib.request import urlretrieve
> >>> urlretrieve('https://gitlab.com/slepc/slepc/-/archive/v3.13.3/slepc-v3.13.3.tar.gz','x.tar.gz')
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/lib64/python3.7/urllib/request.py", line 247, in urlretrieve
> with contextlib.closing(urlopen(url, data)) as fp:
>   File "/usr/lib64/python3.7/urllib/request.py", line 222, in urlopen
> return opener.open(url, data, timeout)
>   File "/usr/lib64/python3.7/urllib/request.py", line 531, in open
> response = meth(req, response)
>   File "/usr/lib64/python3.7/urllib/request.py", line 641, in http_response
> 'http', request, response, code, msg, hdrs)
>   File "/usr/lib64/python3.7/urllib/request.py", line 569, in error
> return self._call_chain(*args)
>   File "/usr/lib64/python3.7/urllib/request.py", line 503, in _call_chain
> result = func(*args)
>   File "/usr/lib64/python3.7/urllib/request.py", line 649, in 
> http_error_default
> raise HTTPError(req.full_url, code, msg, hdrs, fp)
> urllib.error.HTTPError: HTTP Error 403: Forbidden
> >>>
> [balay@pj01 petsc]$ python2
> Python 2.7.18 (default, Apr 20 2020, 00:00:00)
> [GCC 9.3.1 20200408 (Red Hat 9.3.1-2)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from urllib import urlretrieve
> >>> urlretrieve('https://gitlab.com/slepc/slepc/-/archive/v3.13.3/slepc-v3.13.3.tar.gz','x.tar.gz')
> ('x.tar.gz', )
> >>>
> [1]+  Stopped python2
> [balay@pj01 petsc]$ cat x.tar.gz
> error code: 1010[balay@pj01 petsc]$ file x.tar.gz
> x.tar.gz: ASCII text, with no line terminators
> [balay@pj01 petsc]$
>
> On Mon, 27 Jul 2020, Satish Balay via petsc-users wrote:
>
> > Looks like python urlretrive() is failing on glitab tarball urls [but its 
> > working with wget etc. I don't know why.
> >
> > Perhaps its best to have git installed - so that git-urls work..
> >
> > Satish
> >
> > On Tue, 28 Jul 2020, Eda Oktay wrote:
> >
> > > Hi all,
> > >
> > > I am trying to download Petsc with Slepc a linux computer (probably
> > > ubuntu, I don't know because I am using it via ssh) but I am getting
> > > the following error:
> > >
> > > ***
> > >  UNABLE to CONFIGURE with GIVEN OPTIONS(see configure.log
> > > for details):
> > > ---
> > > Error during download/extract/detection of SLEPC:
> > > Unable to download package SLEPC from:
> > > https://gitlab.com/slepc/slepc/-/archive/v3.13.2/slepc-v3.13.2.tar.gz
> > > * If URL specified manually - perhaps there is a typo?
> > > * If your network is disconnected - please reconnect and rerun ./configure
> > > * Or perhaps you have a firewall blocking the download
> > > * You can run with --with-packages-download-dir=/adirectory and
> > > ./configure will instruct you what packages to download manually
> > > * or you can download the above URL manually, to
> > > /yourselectedlocation/slepc-v3.13.2.tar.gz
> > >   and use the configure option:
> > >   --download-slepc=/yourselectedlocation/slepc-v3.13.2.tar.gz
> > > ***
> > >
> > > I attached configure.log.
> > >
> > > Then, I downloaded slepc and used
> > > --download-slepc=/yourselectedlocation/slepc-v3.13.2.tar.gz.
> > >
> > > Since I used WinSCP, tar.gz file was uploaded to my user as "eda" and
> 

Re: [petsc-users] Is PETSc using internet?

2020-07-21 Thread Eda Oktay
Dear Lawrence,

The problem is not the error by the way, my program is waiting something
without stopping and it is not giving error. It just does nothing.

Does the problem is still because of hostname?

Thanks!

Eda

On Tue, Jul 21, 2020, 1:16 PM Lawrence Mitchell  wrote:

>
>
> > On 21 Jul 2020, at 11:06, Eda Oktay  wrote:
> >
> > Dear Lawrence,
> >
> > I am using MPICC but not Mac, Fedora 25. If it will still work, I will
> try that.
> >
> > Thanks!
>
> It might be the case. When you observe the error, does "nslookup
> localhost" take a long time?
>
> Lawrence


Re: [petsc-users] Is PETSc using internet?

2020-07-21 Thread Eda Oktay
Dear Lawrence,

I am using MPICC but not Mac, Fedora 25. If it will still work, I will try that.

Thanks!

Eda

Lawrence Mitchell , 21 Tem 2020 Sal, 12:58 tarihinde
şunu yazdı:
>
>
>
> > On 21 Jul 2020, at 10:49, Eda Oktay  wrote:
> >
> > Hi all,
> >
> > I am using the following libraries and for some reason, I figured out
> > that if ı am disconnected to internet, my program is not working:
>
> [...]
>
> > I thought that there is no reason for PETSc to go online for libraries
> > but I couldn't find any other reason.
> >
> > The first thing I am doing in my program after initializing SLEPc and
> > PETSc is reading the binary matrix from my file and when I am offline,
> > the program can't even get the matrix.
>
> My crystal ball (which sometimes is wrong) guess that you're using a Mac, and 
> MPICH as your MPI version? If so, it may be a problem in MPI_Init failing to 
> resolve localhost to an IP address.
>
> If these guesses are correct, does it help to add
>
> 127.0.0.1   LOCALHOSTNAME.local
> 127.0.0.1   LOCALHOSTNAME
>
> to /etc/hosts
>
> where LOCALHOSTNAME is the name of the machine (as reported by hostname)
>
> Lawrence


[petsc-users] Is PETSc using internet?

2020-07-21 Thread Eda Oktay
Hi all,

I am using the following libraries and for some reason, I figured out
that if ı am disconnected to internet, my program is not working:

#include 

#include 

#include 

#include 

#include 

#include 

#include 

#include 

#include 

#include 

#include 

#include 

#include 

#include 

#include 

#include 

#include 

#include 

I thought that there is no reason for PETSc to go online for libraries
but I couldn't find any other reason.

The first thing I am doing in my program after initializing SLEPc and
PETSc is reading the binary matrix from my file and when I am offline,
the program can't even get the matrix.

Thanks,

Eda


Re: [petsc-users] SLEPc Build Error

2020-07-20 Thread Eda Oktay
Thank you so much, I will try them!

Eda

Jose E. Roman , 20 Tem 2020 Pzt, 10:59 tarihinde şunu yazdı:
>
> I tried to reproduce this on Fedora 25 (with GCC 6.4.1), but the compilation 
> went through without errors.
>
> My recommendation is that if you are using a PETSc tarball, use also a SLEPc 
> tarball, and install it with the usual procedure described in SLEPc's 
> documentation, not with --download-slepc
>
> However, the case of a tarball PETSc with --download-slepc should also work. 
> From the messages in slepc.log, SLEPc has installed Sowing and it fails when 
> generating the Fortran stubs. Maybe installation of Sowing was not 
> successful. To find out, you will have to look at SLEPc logs, and also at 
> Sowing logs under 
> arch-linux2-c-debug/externalpackages/git.slepc/arch-linux2-c-debug/externalpackages/pkg-sowing/
>
> Jose
>
>
> > El 19 jul 2020, a las 19:49, Matthew Knepley  escribió:
> >
> > On Sun, Jul 19, 2020 at 11:01 AM Eda Oktay  wrote:
> > Hi all,
> >
> > I am trying to install petsc 3.13.2 to my computer (fedora 25) with
> > slepc and some other libraries by using the following code:
> >
> > ./configure --with-cc=gcc --with-cxx=g++ --download-mpich
> > --download-openblas --download-slepc --download-metis
> > --download-parmetis --download-chaco --with-X=1
> >
> > Although I installed exact same things to an other computer with
> > fedora 25, this time, after configuration, when I am asked to use
> > "make PETSC_DIR=/home/eda/petsc-3.13.2 PETSC_ARCH=arch-linux2-c-debug
> > all", I got an Slepc error:
> >
> > PETSc thinks you are installing from a tarball, rather than from a Git 
> > clone, because it cannot
> > find the $PETSC_DIR/lib/petsc/bin/maint directory, which we remove from the 
> > tarball. The tarball
> > also contains the Fortran stubs, so we do not install Sowing in this case. 
> > When SLEPc is being
> > installed, it needs to generate the Fortran stubs, since it was cloned.
> >
> > At bottom, you cannot install SLEPc automatically unless you install PETSc 
> > from a Git clone.
> >
> >   Thanks,
> >
> >  Matt
> >
> > *** Building slepc ***
> > **ERROR*
> > Error building slepc. Check arch-linux2-c-debug/lib/petsc/conf/slepc.log
> > 
> > /home/eda/petsc-3.13.2/arch-linux2-c-debug/lib/petsc/conf/petscrules:32:
> > recipe for target 'slepcbuild' failed
> > gmake[2]: *** [slepcbuild] Error 1
> > **ERROR*
> >   Error during compile, check arch-linux2-c-debug/lib/petsc/conf/make.log
> >   Send it and arch-linux2-c-debug/lib/petsc/conf/configure.log to
> > petsc-ma...@mcs.anl.gov
> > 
> > makefile:33: recipe for target 'all' failed
> > make[1]: *** [all] Error 1
> > GNUmakefile:9: recipe for target 'all' failed
> > make: *** [all] Error 2
> >
> > I attached slepc.log, make.log and configure.log. What is the problem?
> > Can you help me please?
> >
> > Thanks a lot!
> >
> > Eda
> >
> >
> > --
> > 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
> >
> > https://www.cse.buffalo.edu/~knepley/
>


Re: [petsc-users] SLEPc EPS Tolerance

2020-07-10 Thread Eda Oktay
Okay thanks again!

On Fri, Jul 10, 2020, 7:52 PM Jose E. Roman  wrote:

> I don't know. This question belongs to the application part, not the
> solver part.
>
> > El 10 jul 2020, a las 18:45, Eda Oktay  escribió:
> >
> > I looked at a2965*2965 sized matrix. I want to ask one last question.
> >
> > For e-8:
> >
> > Linear eigensolve converged (2 eigenpairs) due to CONVERGED_TOL;
> iterations 64
> > -- 
> >k ||Ax-kx||/||kx||
> > -- 
> >0.0024868.60766e-09
> >0.0044661.68813e-09
> > -- 
> >
> > For e-10:
> > Linear eigensolve converged (2 eigenpairs) due to CONVERGED_TOL;
> iterations 74
> > -- 
> >k ||Ax-kx||/||kx||
> > -- 
> >0.002486 9.5257e-11
> >0.0044662.12622e-11
> > -- 
> >
> > But my partition is more qualified when tol=e-8, not e-10.
> >
> > My last question is: Is this because of the iteration number that
> > eigensolver tries to find suitable eigenvalues up to this tolerance?
> >
> > Again, thank you so much!
> >
> > Jose E. Roman , 10 Tem 2020 Cum, 19:36 tarihinde
> şunu yazdı:
> >>
> >> For such small matrix, the solver is essentially solving with a direct
> method via LAPACK. If you understand how projection methods work, iteration
> gets in action when the matrix size is larger than the subspace size (ncv).
> The tolerance is relevant when the solver iterates, not when it computes
> the solution with LAPACK.
> >>
> >> Jose
> >>
> >>
> >>> El 10 jul 2020, a las 18:32, Eda Oktay 
> escribió:
> >>>
> >>> No, it is of size 9
> >>>
> >>> Jose E. Roman , 10 Tem 2020 Cum, 19:31 tarihinde
> şunu yazdı:
> >>>>
> >>>> [Please respond to the list.]
> >>>>
> >>>> Is your matrix of size 8? This would explain the residuals.
> >>>>
> >>>> Jose
> >>>>
> >>>>> El 10 jul 2020, a las 17:10, Eda Oktay 
> escribió:
> >>>>>
> >>>>> I computed residual norm via -eps_error_relative::ascii_info_detail
> >>>>> for different tolerance numbers (e-4, e-6, e-8, e-10). In each
> >>>>> tolerance, I got the same table below:
> >>>>>
> >>>>> -- 
> >>>>>  k ||Ax-kx||/||kx||
> >>>>> -- 
> >>>>>  3.006.25528e-16
> >>>>>  3.007.13774e-16
> >>>>>  3.4384472.64362e-16
> >>>>>  5.004.39333e-16
> >>>>>  6.001.63943e-16
> >>>>>  6.002.93737e-16
> >>>>>  6.003.95997e-16
> >>>>>  7.5615533.48664e-16
> >>>>> -- 
> >>>>>
> >>>>> I understood that since relative error is E-16 and this table shows
> >>>>> eigenvalues whose relative error are below the tolerance, I am
> getting
> >>>>> the same table but I still couldn't understand although relative
> >>>>> errors are so small, how am I getting the most qualified partition in
> >>>>> e-4 tolerance, not e-8. I am not computing zero eigenvalue I believe,
> >>>>> since I am using EPSSetWhichEigenpairs(eps,EPS_SMALLEST_MAGNITUDE);
> >>>>> and I am not getting zero eigenvalue.
> >>>>>
> >>>>> Thanks so much for answering!
> >>>>>
> >>>>> Jose E. Roman , 10 Tem 2020 Cum, 14:09
> tarihinde şunu yazdı:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> El 10 jul 2020, a las 12:54, Eda Oktay 
> escribió:
> >>>>>>>
> >>>>>>>> How do you measure accuracy?
> >>>>>>> Using the word accuracy may be not true actually, I am sorry. I am
> >>>>>>> using eigenvectors corresponding to these eigenvalues in k-means
&

Re: [petsc-users] SLEPc EPS Tolerance

2020-07-10 Thread Eda Oktay
I looked at a2965*2965 sized matrix. I want to ask one last question.

For e-8:

Linear eigensolve converged (2 eigenpairs) due to CONVERGED_TOL; iterations 64
 -- 
k ||Ax-kx||/||kx||
 -- 
0.0024868.60766e-09
0.0044661.68813e-09
 -- 

For e-10:
Linear eigensolve converged (2 eigenpairs) due to CONVERGED_TOL; iterations 74
 -- 
k ||Ax-kx||/||kx||
 -- 
0.002486 9.5257e-11
0.0044662.12622e-11
 -- 

But my partition is more qualified when tol=e-8, not e-10.

My last question is: Is this because of the iteration number that
eigensolver tries to find suitable eigenvalues up to this tolerance?

Again, thank you so much!

Jose E. Roman , 10 Tem 2020 Cum, 19:36 tarihinde şunu yazdı:
>
> For such small matrix, the solver is essentially solving with a direct method 
> via LAPACK. If you understand how projection methods work, iteration gets in 
> action when the matrix size is larger than the subspace size (ncv). The 
> tolerance is relevant when the solver iterates, not when it computes the 
> solution with LAPACK.
>
> Jose
>
>
> > El 10 jul 2020, a las 18:32, Eda Oktay  escribió:
> >
> > No, it is of size 9
> >
> > Jose E. Roman , 10 Tem 2020 Cum, 19:31 tarihinde şunu 
> > yazdı:
> >>
> >> [Please respond to the list.]
> >>
> >> Is your matrix of size 8? This would explain the residuals.
> >>
> >> Jose
> >>
> >>> El 10 jul 2020, a las 17:10, Eda Oktay  escribió:
> >>>
> >>> I computed residual norm via -eps_error_relative::ascii_info_detail
> >>> for different tolerance numbers (e-4, e-6, e-8, e-10). In each
> >>> tolerance, I got the same table below:
> >>>
> >>> -- 
> >>>   k ||Ax-kx||/||kx||
> >>> -- 
> >>>   3.006.25528e-16
> >>>   3.007.13774e-16
> >>>   3.4384472.64362e-16
> >>>   5.004.39333e-16
> >>>   6.001.63943e-16
> >>>   6.002.93737e-16
> >>>   6.003.95997e-16
> >>>   7.5615533.48664e-16
> >>> -- 
> >>>
> >>> I understood that since relative error is E-16 and this table shows
> >>> eigenvalues whose relative error are below the tolerance, I am getting
> >>> the same table but I still couldn't understand although relative
> >>> errors are so small, how am I getting the most qualified partition in
> >>> e-4 tolerance, not e-8. I am not computing zero eigenvalue I believe,
> >>> since I am using EPSSetWhichEigenpairs(eps,EPS_SMALLEST_MAGNITUDE);
> >>> and I am not getting zero eigenvalue.
> >>>
> >>> Thanks so much for answering!
> >>>
> >>> Jose E. Roman , 10 Tem 2020 Cum, 14:09 tarihinde şunu 
> >>> yazdı:
> >>>>
> >>>>
> >>>>
> >>>>> El 10 jul 2020, a las 12:54, Eda Oktay  escribió:
> >>>>>
> >>>>>> How do you measure accuracy?
> >>>>> Using the word accuracy may be not true actually, I am sorry. I am
> >>>>> using eigenvectors corresponding to these eigenvalues in k-means
> >>>>> algorithm, then do spectral graph partitioning. I must look at the
> >>>>> partition quality. By quality, I mean, the resulting edge cut of my
> >>>>> partitioned graph. I thought that the less tolerance results in more
> >>>>> accuracy, hence more qualified partition.
> >>>>>
> >>>>>> What do you mean "the result was still the same"?
> >>>>> I mean I am still not getting the most qualified solution in E-10,
> >>>>> still E-2 or E-6 gives more qualified partitions, i.e. they give less
> >>>>> edge cut.
> >>>>>
> >>>>>> What is the eigenvalue you are computing?
> >>>>> I am computing the smallest eigenvalue of a Laplacian matrix.
> >>>>
> >>>> You should compute the residual norm, for instance with 
> >>>> -eps_error_relative ::ascii_info_detail (see section 2.5.4 of the 
> >>>> manual).
> >>>> The relative residual error should be in the order of the tolerance (or 
> >>>> smaller) if using the default convergence test, but if you are computing 
> >>>> a zero eigenvalue then you may want to use an absolute convergence 
> >>>> criterion (see table 2.6 or the manual). A graph Laplacian has at least 
> >>>> one zero eigenvalue, unless you deflate it as explained in section 2.6.2 
> >>>> of the manual, see also ex11.c 
> >>>> https://slepc.upv.es/documentation/current/src/eps/tutorials/ex11.c.html
> >>>>
> >>>> Jose
> >>>>
> >>
>


Re: [petsc-users] SLEPc EPS Tolerance

2020-07-10 Thread Eda Oktay
No, it is of size 9

Jose E. Roman , 10 Tem 2020 Cum, 19:31 tarihinde şunu yazdı:
>
> [Please respond to the list.]
>
> Is your matrix of size 8? This would explain the residuals.
>
> Jose
>
> > El 10 jul 2020, a las 17:10, Eda Oktay  escribió:
> >
> > I computed residual norm via -eps_error_relative::ascii_info_detail
> > for different tolerance numbers (e-4, e-6, e-8, e-10). In each
> > tolerance, I got the same table below:
> >
> > -- 
> >k ||Ax-kx||/||kx||
> > -- 
> >3.006.25528e-16
> >3.007.13774e-16
> >3.4384472.64362e-16
> >5.004.39333e-16
> >6.001.63943e-16
> >6.002.93737e-16
> >6.003.95997e-16
> >7.5615533.48664e-16
> > -- 
> >
> > I understood that since relative error is E-16 and this table shows
> > eigenvalues whose relative error are below the tolerance, I am getting
> > the same table but I still couldn't understand although relative
> > errors are so small, how am I getting the most qualified partition in
> > e-4 tolerance, not e-8. I am not computing zero eigenvalue I believe,
> > since I am using EPSSetWhichEigenpairs(eps,EPS_SMALLEST_MAGNITUDE);
> > and I am not getting zero eigenvalue.
> >
> > Thanks so much for answering!
> >
> > Jose E. Roman , 10 Tem 2020 Cum, 14:09 tarihinde şunu 
> > yazdı:
> >>
> >>
> >>
> >>> El 10 jul 2020, a las 12:54, Eda Oktay  escribió:
> >>>
> >>>> How do you measure accuracy?
> >>> Using the word accuracy may be not true actually, I am sorry. I am
> >>> using eigenvectors corresponding to these eigenvalues in k-means
> >>> algorithm, then do spectral graph partitioning. I must look at the
> >>> partition quality. By quality, I mean, the resulting edge cut of my
> >>> partitioned graph. I thought that the less tolerance results in more
> >>> accuracy, hence more qualified partition.
> >>>
> >>>> What do you mean "the result was still the same"?
> >>> I mean I am still not getting the most qualified solution in E-10,
> >>> still E-2 or E-6 gives more qualified partitions, i.e. they give less
> >>> edge cut.
> >>>
> >>>> What is the eigenvalue you are computing?
> >>> I am computing the smallest eigenvalue of a Laplacian matrix.
> >>
> >> You should compute the residual norm, for instance with 
> >> -eps_error_relative ::ascii_info_detail (see section 2.5.4 of the manual).
> >> The relative residual error should be in the order of the tolerance (or 
> >> smaller) if using the default convergence test, but if you are computing a 
> >> zero eigenvalue then you may want to use an absolute convergence criterion 
> >> (see table 2.6 or the manual). A graph Laplacian has at least one zero 
> >> eigenvalue, unless you deflate it as explained in section 2.6.2 of the 
> >> manual, see also ex11.c 
> >> https://slepc.upv.es/documentation/current/src/eps/tutorials/ex11.c.html
> >>
> >> Jose
> >>
>


[petsc-users] SLEPc EPS Tolerance

2020-07-10 Thread Eda Oktay
Hello,

I am currently using EPS to find 2 smallest eigenvalues and
corresponding eigenvectors of a matrix in order to be used in spectral
graph partitioning algorithms. I know that default tolerance is E-8
and I also tried the solver with tolerances E-2, E-4 and E-6 expecting
that in every matrix I used, I get the most accurate solution (After
partitioning the matrix, I look at edge cut for accuracy) when
tolerance is E-8.

I even tried E-10 and the result was still the same, sometimes E-4 or
E-2 gives better results.

I was wondering if this is normal, if normal then how can we explain
this? Because in theory, one can expect that if tolerance decreases,
accuracy increases.

Thanks!

Eda


Re: [petsc-users] /lib64/libc.so.6(cfree+0x1f8)[0x7f810f237438] Signal received

2020-07-06 Thread Eda Oktay
I tried for (count=1;count<2;++count), it is working. When I raised it to
3, it started giving the same error.

My loop is inside my compiled program, not bash.

I started the loop after PetscInitialize and finished it before
PetscFinalize.

I am not using MPI_Init.

Thanks!

On Mon, Jul 6, 2020, 10:51 PM Barry Smith  wrote:

>
>  Where is your loop? In a bash script or inside your compiled program?
>
>  If inside the program I assume it is outside of PetscInitialize()?
>
>  Is it outside of MPI_Init()?  It can't be because MPI_Init() can only be
> called once.
>
>   If inside the problem you can use -start_in_debugger to get the true
> location of the crash, if in a bash script you can use
> -on_error_attach_debugger
>
>   Barry
>
>
> > On Jul 6, 2020, at 1:14 PM, Eda Oktay  wrote:
> >
> > Hello,
> >
> > I am trying to run my codes 100 times and then take the average
> > elapsed time. Although my program runs correctly for single time, when
> > I put them into loop, I am getting the following error:
> >
> > *** Error in `./avg_coloredge_deneme_new_vecscatter_arastep':
> > munmap_chunk(): invalid pointer: 0x00b0cbc0 ***
> > [1]PETSC ERROR:
> > 
> > [1]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation,
> > probably memory access out of range
> > [1]PETSC ERROR: Try option -start_in_debugger or
> -on_error_attach_debugger
> > [1]PETSC ERROR: or see
> > https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind
> > [1]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac
> > OS X to find memory corruption errors
> > [1]PETSC ERROR: likely location of problem given in stack below
> > [1]PETSC ERROR: -  Stack Frames
> > 
> > [1]PETSC ERROR: Note: The EXACT line numbers in the stack are not
> available,
> > [1]PETSC ERROR:   INSTEAD the line number of the start of the
> function
> > [1]PETSC ERROR:   is given.
> > === Backtrace: =
> > [1]PETSC ERROR: /lib64/libc.so.6(+0x791eb)[0x7f810f22a1eb]
> > - Error Message
> > --
> > [1]PETSC ERROR: /lib64/libc.so.6(cfree+0x1f8)[0x7f810f237438]
> > Signal received
> > [1]PETSC ERROR: See
> > https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
> > shooting.
> > [1]PETSC ERROR: Petsc Release Version 3.13.2, Jun 02, 2020
> > [1]PETSC ERROR: ./avg_coloredge_deneme_new_vecscatter_arastep on a
> > arch-linux2-c-debug named localhost.localdomain by edaoktay Mon Jul  6
> > 21:09:07 2020
> > [1]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
> > --download-mpich --download-openblas --download-slepc --download-metis
> > --download-parmetis --download-chaco --with-X=1
> > [1]PETSC ERROR: #1 User provided function() line 0 in  unknown file
> > ./avg_coloredge_deneme_new_vecscatter_arastep[0x402dca]
> > ./avg_coloredge_deneme_new_vecscatter_arastep[0x402f1e]
> > ./avg_coloredge_deneme_new_vecscatter_arastep[0x402953]
> > ./avg_coloredge_deneme_new_vecscatter_arastep[0x406c1c]
> > application called MPI_Abort(MPI_COMM_WORLD, 50152059) - process 1
> > /lib64/libc.so.6(__libc_start_main+0xf1)[0x7f810f1d1431]
> > ./avg_coloredge_deneme_new_vecscatter_arastep[0x40260a]
> > === Memory map: 
> > 0040-00409000 r-xp  fd:02 29230434
> >
> /home/edaoktay/petsc-3.13.2/arch-linux2-c-debug/share/slepc/examples/src/eda/avg_coloredge_deneme_new_vecscatter_arastep
> > 00608000-00609000 r--p 8000 fd:02 29230434
> >
> /home/edaoktay/petsc-3.13.2/arch-linux2-c-debug/share/slepc/examples/src/eda/avg_coloredge_deneme_new_vecscatter_arastep
> > 00609000-0060a000 rw-p 9000 fd:02 29230434
> >
> /home/edaoktay/petsc-3.13.2/arch-linux2-c-debug/share/slepc/examples/src/eda/avg_coloredge_deneme_new_vecscatter_arastep
> > 00956000-0110 rw-p  00:00 0
> [heap]
> > 7f810c621000-7f810c6ca000 rw-p  00:00 0
> > 7f810c6ca000-7f810e6ca000 rw-p  00:00 0
> > 7f810e6ca000-7f810e6d4000 r-xp  fd:00 1974339
> >  /usr/lib64/libnss_files-2.24.so
> > 7f810e6d4000-7f810e8d4000 ---p a000 fd:00 1974339
> >  /usr/lib64/libnss_files-2.24.so
> > 7f810e8d4000-7f810e8d5000 r--p a000 fd:00 1974339
> >  /usr/lib64/libnss_files-2.24.so
> > 7f810e8d5000-7f810e8d6000 rw-p b000 fd:00 1974339
> >  /usr/lib64/libnss_files-2.24.so
> > 7f810e8d6000-7f810eb7d000 rw-p  00:00 0
> > 7f810eb7d0

[petsc-users] /lib64/libc.so.6(cfree+0x1f8)[0x7f810f237438] Signal received

2020-07-06 Thread Eda Oktay
Hello,

I am trying to run my codes 100 times and then take the average
elapsed time. Although my program runs correctly for single time, when
I put them into loop, I am getting the following error:

*** Error in `./avg_coloredge_deneme_new_vecscatter_arastep':
munmap_chunk(): invalid pointer: 0x00b0cbc0 ***
[1]PETSC ERROR:

[1]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation,
probably memory access out of range
[1]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[1]PETSC ERROR: or see
https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind
[1]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac
OS X to find memory corruption errors
[1]PETSC ERROR: likely location of problem given in stack below
[1]PETSC ERROR: -  Stack Frames

[1]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,
[1]PETSC ERROR:   INSTEAD the line number of the start of the function
[1]PETSC ERROR:   is given.
=== Backtrace: =
[1]PETSC ERROR: /lib64/libc.so.6(+0x791eb)[0x7f810f22a1eb]
- Error Message
--
[1]PETSC ERROR: /lib64/libc.so.6(cfree+0x1f8)[0x7f810f237438]
Signal received
[1]PETSC ERROR: See
https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
shooting.
[1]PETSC ERROR: Petsc Release Version 3.13.2, Jun 02, 2020
[1]PETSC ERROR: ./avg_coloredge_deneme_new_vecscatter_arastep on a
arch-linux2-c-debug named localhost.localdomain by edaoktay Mon Jul  6
21:09:07 2020
[1]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--download-mpich --download-openblas --download-slepc --download-metis
--download-parmetis --download-chaco --with-X=1
[1]PETSC ERROR: #1 User provided function() line 0 in  unknown file
./avg_coloredge_deneme_new_vecscatter_arastep[0x402dca]
./avg_coloredge_deneme_new_vecscatter_arastep[0x402f1e]
./avg_coloredge_deneme_new_vecscatter_arastep[0x402953]
./avg_coloredge_deneme_new_vecscatter_arastep[0x406c1c]
application called MPI_Abort(MPI_COMM_WORLD, 50152059) - process 1
/lib64/libc.so.6(__libc_start_main+0xf1)[0x7f810f1d1431]
./avg_coloredge_deneme_new_vecscatter_arastep[0x40260a]
=== Memory map: 
0040-00409000 r-xp  fd:02 29230434
  
/home/edaoktay/petsc-3.13.2/arch-linux2-c-debug/share/slepc/examples/src/eda/avg_coloredge_deneme_new_vecscatter_arastep
00608000-00609000 r--p 8000 fd:02 29230434
  
/home/edaoktay/petsc-3.13.2/arch-linux2-c-debug/share/slepc/examples/src/eda/avg_coloredge_deneme_new_vecscatter_arastep
00609000-0060a000 rw-p 9000 fd:02 29230434
  
/home/edaoktay/petsc-3.13.2/arch-linux2-c-debug/share/slepc/examples/src/eda/avg_coloredge_deneme_new_vecscatter_arastep
00956000-0110 rw-p  00:00 0  [heap]
7f810c621000-7f810c6ca000 rw-p  00:00 0
7f810c6ca000-7f810e6ca000 rw-p  00:00 0
7f810e6ca000-7f810e6d4000 r-xp  fd:00 1974339
  /usr/lib64/libnss_files-2.24.so
7f810e6d4000-7f810e8d4000 ---p a000 fd:00 1974339
  /usr/lib64/libnss_files-2.24.so
7f810e8d4000-7f810e8d5000 r--p a000 fd:00 1974339
  /usr/lib64/libnss_files-2.24.so
7f810e8d5000-7f810e8d6000 rw-p b000 fd:00 1974339
  /usr/lib64/libnss_files-2.24.so
7f810e8d6000-7f810eb7d000 rw-p  00:00 0
7f810eb7d000-7f810eb7f000 r-xp  fd:00 1974984
  /usr/lib64/libXau.so.6.0.0
7f810eb7f000-7f810ed7f000 ---p 2000 fd:00 1974984
  /usr/lib64/libXau.so.6.0.0
7f810ed7f000-7f810ed8 r--p 2000 fd:00 1974984
  /usr/lib64/libXau.so.6.0.0
7f810ed8-7f810ed81000 rw-p  00:00 0
7f810ed81000-7f810ed88000 r-xp  fd:00 1974440
  /usr/lib64/librt-2.24.so
7f810ed88000-7f810ef87000 ---p 7000 fd:00 1974440
  /usr/lib64/librt-2.24.so
7f810ef87000-7f810ef88000 r--p 6000 fd:00 1974440
  /usr/lib64/librt-2.24.so
7f810ef88000-7f810ef89000 rw-p 7000 fd:00 1974440
  /usr/lib64/librt-2.24.so
7f810ef89000-7f810efb r-xp  fd:00 1975953
  /usr/lib64/libxcb.so.1.1.0
7f810efb-7f810f1af000 ---p 00027000 fd:00 1975953
  /usr/lib64/libxcb.so.1.1.0
7f810f1af000-7f810f1b r--p 00026000 fd:00 1975953
  /usr/lib64/libxcb.so.1.1.0
7f810f1b-7f810f1b1000 rw-p 00027000 fd:00 1975953
  /usr/lib64/libxcb.so.1.1.0
7f810f1b1000-7f810f36e000 r-xp  fd:00 1973798
  /usr/lib64/libc-2.24.so
7f810f36e000-7f810f56d000 ---p 001bd000 fd:00 1973798
  /usr/lib64/libc-2.24.so
7f810f56d000-7f810f571000 r--p 001bc000 fd:00 1973798
  /usr/lib64/libc-2.24.so
7f810f571000-7f810f573000 rw-p 001c fd:00 1973798
  /usr/lib64/libc-2.24.so
7f810f573000-7f810f577000 rw-p  00:00 0
7f810f577000-7f810f5b6000 r-xp  fd:00 1975094
  /usr/lib64/libquadmath.so.0.0.0
7f810f5b6000-7f810f7b5000 ---p 0003f000 fd:00 1975094
  /usr/lib64/libquadmath.so.0.0.0
7f810f7b5000-7f810f7b6000 r--p 0003e000 

Re: [petsc-users] EPSGetEigenpair Error

2020-07-06 Thread Eda Oktay
Thanks!

Jose E. Roman , 6 Tem 2020 Pzt, 12:10 tarihinde şunu yazdı:
>
> The index i should be a value between 0 and nconv-1
> https://slepc.upv.es/documentation/current/docs/manualpages/EPS/EPSGetEigenpair.html
> Jose
>
> > El 6 jul 2020, a las 11:06, Eda Oktay  escribió:
> >
> > Hello,
> >
> > I am using EPSGetEigenpair to find some matrices' eigenpairs:
> >
> > ierr = EPSGetType(eps,);CHKERRQ(ierr)
> >  ierr = EPSGetDimensions(eps,,NULL,NULL);CHKERRQ(ierr);
> >  ierr = MatCreateVecs(L,,NULL);CHKERRQ(ierr);
> >  Vec *V;
> >  VecDuplicateVecs(vr,nev,);
> >  for (i=0; i >  ierr = EPSGetEigenpair(eps,i,,NULL,V[i],NULL);
> >  }
> >
> > However, for some matrices, even though nev = 2, I am getting the
> > following error:
> >
> > [0]PETSC ERROR: - Error Message
> > --
> > [0]PETSC ERROR: Argument out of range
> > [0]PETSC ERROR: Argument 2 out of range
> > [0]PETSC ERROR: See
> > https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
> > shooting.
> > [0]PETSC ERROR: Petsc Release Version 3.13.2, Jun 02, 2020
> > [0]PETSC ERROR: ./deneme_new_vecscatter_arastep on a
> > arch-linux2-c-debug named b342.wls.metu.edu.tr by edaoktay Mon Jul  6
> > 12:01:14 2020
> > [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
> > --download-mpich --download-openblas --download-slepc --download-metis
> > --download-parmetis --download-chaco --with-X=1
> > [0]PETSC ERROR: #1 EPSGetEigenpair() line 411 in
> > /home/edaoktay/petsc-3.13.2/arch-linux2-c-debug/externalpackages/git.slepc/src/eps/interface/epssolve.c
> >
> > ===
> > =   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
> > =   PID 8635 RUNNING AT b342.wls.metu.edu.tr
> > =   EXIT CODE: 134
> > =   CLEANING UP REMAINING PROCESSES
> > =   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
> > ===
> > YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Aborted (signal 6)
> > This typically refers to a problem with your application.
> > Please see the FAQ page for debugging suggestions
> >
> > What can be the reason? I am getting this message when i = 0, so how
> > can 0 be out of range for nev = 2?
> >
> > And why am I getting this message for 2 matrices out of 16?
> >
> > Thanks!
>


[petsc-users] EPSGetEigenpair Error

2020-07-06 Thread Eda Oktay
Hello,

I am using EPSGetEigenpair to find some matrices' eigenpairs:

ierr = EPSGetType(eps,);CHKERRQ(ierr)
  ierr = EPSGetDimensions(eps,,NULL,NULL);CHKERRQ(ierr);
  ierr = MatCreateVecs(L,,NULL);CHKERRQ(ierr);
  Vec *V;
  VecDuplicateVecs(vr,nev,);
  for (i=0; ihttps://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
shooting.
[0]PETSC ERROR: Petsc Release Version 3.13.2, Jun 02, 2020
[0]PETSC ERROR: ./deneme_new_vecscatter_arastep on a
arch-linux2-c-debug named b342.wls.metu.edu.tr by edaoktay Mon Jul  6
12:01:14 2020
[0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--download-mpich --download-openblas --download-slepc --download-metis
--download-parmetis --download-chaco --with-X=1
[0]PETSC ERROR: #1 EPSGetEigenpair() line 411 in
/home/edaoktay/petsc-3.13.2/arch-linux2-c-debug/externalpackages/git.slepc/src/eps/interface/epssolve.c

===
=   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
=   PID 8635 RUNNING AT b342.wls.metu.edu.tr
=   EXIT CODE: 134
=   CLEANING UP REMAINING PROCESSES
=   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
===
YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Aborted (signal 6)
This typically refers to a problem with your application.
Please see the FAQ page for debugging suggestions

What can be the reason? I am getting this message when i = 0, so how
can 0 be out of range for nev = 2?

And why am I getting this message for 2 matrices out of 16?

Thanks!


Re: [petsc-users] MatGetRow for global rows of a parallel matrix

2020-07-02 Thread Eda Oktay
Thank you so much!

Eda

Zhang, Hong , 2 Tem 2020 Per, 07:29 tarihinde şunu yazdı:
>
> Dense matrix is stored in column-major order, so you might want to use 
> MatGetColumnVector() to access columns of the matrix instead of the rows. For 
> instance, you can get the n-th column out of the matrix and place it into a 
> vector that shares the same parallel layout as the matrix with the following:
>
>   MatDenseGetColumn(J,n,);
>   VecPlaceArray(vec,xarr);
>   ...
>   VecResetArray(vec);
>   MatDenseRestoreColumn(J,);
>
> Hong (Mr.)
>
> On Jun 10, 2020, at 8:08 AM, Eda Oktay  wrote:
>
> Dear Matt,
>
> Matthew Knepley , 10 Haz 2020 Çar, 16:03 tarihinde
> şunu yazdı:
>
>
> On Wed, Jun 10, 2020 at 8:56 AM Eda Oktay  wrote:
>
>
> Hi all,
>
> I am trying to get all the rows of a parallel matrix as individual
> vectors. For instance, if I have 72*4 matrix, I want to get 72
> different vectors having size 4.
>
> As far as I understood, MatGetRow is only for local rows, so
> MatGetOwnershipRange is used, however, when I tried this one, I
> couldn't get the whole and desired row vectors.
>
> In MatGetRow explanation, it is written that I should use
> MatCreateSubMatrices first, then use MatGetRow. But I couldn't
> understand to which extent I should create submatrices. I just need to
> have all 72 rows as 72 different vectors each having 4 elements.
>
>
>
> 1) For sparse matrices, the storage is always divided by row, so that values 
> can only be retrieved for local rows with MatGetRow()
>
> 2) Is this matrix sparse? It sounds like it is dense.
>
>
> Matrix is dense.
>
>
> 3) Are you asking to get all matrix values on all processes? If so, I think 
> the easiest thing to do is first wrap a Vec around the
>values, then use VecScatterToAll(), then wrap each one in a MatDense again.
>
>
> Yes, I want all row vectors on all processes. In a dense matrix,
> should I still wrap a Vec around the values? I know I should use
> scatter but I couldn't even wrap a Vec around them.
>
> Thanks so much!
>
> Eda
>
>
>  Thanks,
>
> Matt
>
>
> Thanks!
>
> Eda
>
>
>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/
>
>


Re: [petsc-users] MatGetRow for global rows of a parallel matrix

2020-07-01 Thread Eda Oktay
I got it, thanks so much!

Eda

On Wed, Jul 1, 2020, 2:42 PM Matthew Knepley  wrote:

> On Wed, Jul 1, 2020 at 7:32 AM Eda Oktay  wrote:
>
>> I'm sorry but I still can't understand how to put an input as these
>> parameters. It is the first time I saw 'const' for IS.  If it doesn't
>> refer IS, then as a parameter for row and column indices, how should I
>> give them as a valid input? It still should be an IS, right?
>>
>> Lastly, I tried to use in the form:
>>
>> IS idUi;
>> ISCreateStride(PETSC_COMM_WORLD,siz,0,1,);
>>  Mat *submat;
>>   MatCreateSubMatrices(U,nev,,,MAT_INITIAL_MATRIX,);
>>
>
> You gave n = 4 (you call it nev), but you only have 1 rowIS. You are
> supposed to give an array of 4.
>
>   Thanks,
>
>  Matt
>
>
>> where nev = 4, siz = 72 and U is 72*4 matrix.
>>
>> But then, the error becomes about the matrix, U:
>>
>> [0]PETSC ERROR: - Error Message
>> --
>> [0]PETSC ERROR: [1]PETSC ERROR: - Error Message
>> --
>> [1]PETSC ERROR: Invalid argument
>> [1]PETSC ERROR: Wrong type of object: Parameter # 1
>> Invalid argument
>> [0]PETSC ERROR: Wrong type of object: Parameter # 1
>> [0]PETSC ERROR: See
>> https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
>> shooting.
>> [0]PETSC ERROR: Petsc Release Version 3.13.2, Jun 02, 2020
>> [0]PETSC ERROR: ./deneme_new_vecscatter_arastep on a
>> arch-linux2-c-debug named b342.wls.metu.edu.tr by edaoktay Wed Jul  1
>> 14:25:00 2020
>> [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
>> --download-mpich --download-openblas --download-slepc --download-metis
>> --download-parmetis --download-chaco --with-X=1
>> [1]PETSC ERROR: See
>> https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
>> shooting.
>> [1]PETSC ERROR: Petsc Release Version 3.13.2, Jun 02, 2020
>> [1]PETSC ERROR: [0]PETSC ERROR: #1 ISSorted() line 1777 in
>> /home/edaoktay/petsc-3.13.2/src/vec/is/is/interface/index.c
>> [0]PETSC ERROR: ./deneme_new_vecscatter_arastep on a
>> arch-linux2-c-debug named b342.wls.metu.edu.tr by edaoktay Wed Jul  1
>> 14:25:00 2020
>> [1]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
>> --download-mpich --download-openblas --download-slepc --download-metis
>> --download-parmetis --download-chaco --with-X=1
>> [1]PETSC ERROR: #2 MatCreateSubMatrices_MPIDense_Local() line 104 in
>> /home/edaoktay/petsc-3.13.2/src/mat/impls/dense/mpi/mmdense.c
>> [0]PETSC ERROR: #3 MatCreateSubMatrices_MPIDense() line 66 in
>> /home/edaoktay/petsc-3.13.2/src/mat/impls/dense/mpi/mmdense.c
>> #1 ISSorted() line 1777 in
>> /home/edaoktay/petsc-3.13.2/src/vec/is/is/interface/index.c
>> [1]PETSC ERROR: #2 MatCreateSubMatrices_MPIDense_Local() line 104 in
>> /home/edaoktay/petsc-3.13.2/src/mat/impls/dense/mpi/mmdense.c
>> [0]PETSC ERROR: #4 MatCreateSubMatrices() line 6758 in
>> /home/edaoktay/petsc-3.13.2/src/mat/interface/matrix.c
>> [1]PETSC ERROR: #3 MatCreateSubMatrices_MPIDense() line 66 in
>> /home/edaoktay/petsc-3.13.2/src/mat/impls/dense/mpi/mmdense.c
>> [1]PETSC ERROR: #4 MatCreateSubMatrices() line 6758 in
>> /home/edaoktay/petsc-3.13.2/src/mat/interface/matrix.c
>>
>> Before I used , I tried to use just idUi (without & sign) and it
>> didn't work, so I decided to try using this way, since may be 'const'
>> refers this one. But how can my matrix be of wrong type? It is MPI
>> Dense.
>>
>> Thanks!
>>
>> Eda
>>
>> Matthew Knepley , 1 Tem 2020 Çar, 13:43 tarihinde
>> şunu yazdı:
>> >
>> > On Wed, Jul 1, 2020 at 6:34 AM Eda Oktay  wrote:
>> >>
>> >> Der Barry,
>> >>
>> >> ı am trying to use your way but I couldn't understand how I create sub
>> >> matrices by using MatCreateSubMatrices() since as input, the function
>> >> needs const IS instead of IS and I couldn't understand how to get a
>> >> const IS. I tried to use ISCreateStride since this IS should be 0:71
>> >> because as you mentioned, the sub matrix should consist of the entire
>> >> matrix. However, since ISCreateStride produces IS, not const IS, I
>> >> couldn't use it in MatCreateSubMatrices().
>> >
>> >
>> > The 'const' refers to the array, not the IS:
>> >
>> >
>> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateSubMatrices.html
>>

Re: [petsc-users] MatGetRow for global rows of a parallel matrix

2020-07-01 Thread Eda Oktay
I'm sorry but I still can't understand how to put an input as these
parameters. It is the first time I saw 'const' for IS.  If it doesn't
refer IS, then as a parameter for row and column indices, how should I
give them as a valid input? It still should be an IS, right?

Lastly, I tried to use in the form:

IS idUi;
ISCreateStride(PETSC_COMM_WORLD,siz,0,1,);
 Mat *submat;
  MatCreateSubMatrices(U,nev,,,MAT_INITIAL_MATRIX,);

where nev = 4, siz = 72 and U is 72*4 matrix.

But then, the error becomes about the matrix, U:

[0]PETSC ERROR: - Error Message
--
[0]PETSC ERROR: [1]PETSC ERROR: - Error Message
--
[1]PETSC ERROR: Invalid argument
[1]PETSC ERROR: Wrong type of object: Parameter # 1
Invalid argument
[0]PETSC ERROR: Wrong type of object: Parameter # 1
[0]PETSC ERROR: See
https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
shooting.
[0]PETSC ERROR: Petsc Release Version 3.13.2, Jun 02, 2020
[0]PETSC ERROR: ./deneme_new_vecscatter_arastep on a
arch-linux2-c-debug named b342.wls.metu.edu.tr by edaoktay Wed Jul  1
14:25:00 2020
[0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--download-mpich --download-openblas --download-slepc --download-metis
--download-parmetis --download-chaco --with-X=1
[1]PETSC ERROR: See
https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
shooting.
[1]PETSC ERROR: Petsc Release Version 3.13.2, Jun 02, 2020
[1]PETSC ERROR: [0]PETSC ERROR: #1 ISSorted() line 1777 in
/home/edaoktay/petsc-3.13.2/src/vec/is/is/interface/index.c
[0]PETSC ERROR: ./deneme_new_vecscatter_arastep on a
arch-linux2-c-debug named b342.wls.metu.edu.tr by edaoktay Wed Jul  1
14:25:00 2020
[1]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--download-mpich --download-openblas --download-slepc --download-metis
--download-parmetis --download-chaco --with-X=1
[1]PETSC ERROR: #2 MatCreateSubMatrices_MPIDense_Local() line 104 in
/home/edaoktay/petsc-3.13.2/src/mat/impls/dense/mpi/mmdense.c
[0]PETSC ERROR: #3 MatCreateSubMatrices_MPIDense() line 66 in
/home/edaoktay/petsc-3.13.2/src/mat/impls/dense/mpi/mmdense.c
#1 ISSorted() line 1777 in
/home/edaoktay/petsc-3.13.2/src/vec/is/is/interface/index.c
[1]PETSC ERROR: #2 MatCreateSubMatrices_MPIDense_Local() line 104 in
/home/edaoktay/petsc-3.13.2/src/mat/impls/dense/mpi/mmdense.c
[0]PETSC ERROR: #4 MatCreateSubMatrices() line 6758 in
/home/edaoktay/petsc-3.13.2/src/mat/interface/matrix.c
[1]PETSC ERROR: #3 MatCreateSubMatrices_MPIDense() line 66 in
/home/edaoktay/petsc-3.13.2/src/mat/impls/dense/mpi/mmdense.c
[1]PETSC ERROR: #4 MatCreateSubMatrices() line 6758 in
/home/edaoktay/petsc-3.13.2/src/mat/interface/matrix.c

Before I used , I tried to use just idUi (without & sign) and it
didn't work, so I decided to try using this way, since may be 'const'
refers this one. But how can my matrix be of wrong type? It is MPI
Dense.

Thanks!

Eda

Matthew Knepley , 1 Tem 2020 Çar, 13:43 tarihinde şunu yazdı:
>
> On Wed, Jul 1, 2020 at 6:34 AM Eda Oktay  wrote:
>>
>> Der Barry,
>>
>> ı am trying to use your way but I couldn't understand how I create sub
>> matrices by using MatCreateSubMatrices() since as input, the function
>> needs const IS instead of IS and I couldn't understand how to get a
>> const IS. I tried to use ISCreateStride since this IS should be 0:71
>> because as you mentioned, the sub matrix should consist of the entire
>> matrix. However, since ISCreateStride produces IS, not const IS, I
>> couldn't use it in MatCreateSubMatrices().
>
>
> The 'const' refers to the array, not the IS:
>
>   
> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateSubMatrices.html
>
>   Thanks,
>
> Matt
>
>>
>> Thanks
>>
>> Eda
>>
>> Barry Smith , 10 Haz 2020 Çar, 19:59 tarihinde şunu yazdı:
>> >
>> >
>> >   You can use MatCreateSubMatrices() with each process getting a single 
>> > sequential dense sub matrix that consists of the entire matrix.
>> >
>> >   Use VecDuplicateVecs() to create an array of 72 vectors (create a single 
>> > seq vector of size 4 as the input to this routine)
>> >
>> >   Then use MatDenseGetArrayRead() to access the upper left corner of the 
>> > new sequential dense matrix
>> >
>> >   Loop over the vectors calling VecGetArray()
>> >  Then loop over the row of the dense array filling up the vector
>> >
>> >   Because dense matrices are stored by column, you have to do this looping 
>> > to fill up the vectors, they can't share the space with the matrix.
>> >
>> >   Barry
>> >
>> >
>> >
>>

Re: [petsc-users] MatGetRow for global rows of a parallel matrix

2020-07-01 Thread Eda Oktay
Der Barry,

ı am trying to use your way but I couldn't understand how I create sub
matrices by using MatCreateSubMatrices() since as input, the function
needs const IS instead of IS and I couldn't understand how to get a
const IS. I tried to use ISCreateStride since this IS should be 0:71
because as you mentioned, the sub matrix should consist of the entire
matrix. However, since ISCreateStride produces IS, not const IS, I
couldn't use it in MatCreateSubMatrices().

Thanks

Eda

Barry Smith , 10 Haz 2020 Çar, 19:59 tarihinde şunu yazdı:
>
>
>   You can use MatCreateSubMatrices() with each process getting a single 
> sequential dense sub matrix that consists of the entire matrix.
>
>   Use VecDuplicateVecs() to create an array of 72 vectors (create a single 
> seq vector of size 4 as the input to this routine)
>
>   Then use MatDenseGetArrayRead() to access the upper left corner of the new 
> sequential dense matrix
>
>   Loop over the vectors calling VecGetArray()
>  Then loop over the row of the dense array filling up the vector
>
>   Because dense matrices are stored by column, you have to do this looping to 
> fill up the vectors, they can't share the space with the matrix.
>
>   Barry
>
>
>
> On Jun 10, 2020, at 11:36 AM, Matthew Knepley  wrote:
>
> On Wed, Jun 10, 2020 at 12:26 PM Eda Oktay  wrote:
>>
>> Matthew Knepley , 10 Haz 2020 Çar, 19:13 tarihinde
>> şunu yazdı:
>> >
>> > On Wed, Jun 10, 2020 at 12:07 PM Eda Oktay  wrote:
>> >>
>> >> Der Matt,
>> >>
>> >> When I looked at the results, I found that there are some problems I
>> >> couldn't understand.
>> >>
>> >> First of all, I am working on a 72*4 matrix and as I said before, I
>> >> want to have 72 different vectors having size 4 each, whose elements
>> >> consist of the elements in the same row. And of course, all vectors
>> >> should be in all processors (currently I am using 4 processors).
>> >>
>> >> When I use your scatter code, the output vector is divided into 4
>> >> parts for 4 processors and each vector consists of 18 row vectors
>> >> whose elements are arranged in a way that if I want to find zeroth row
>> >> vector, its elements are located in 0th,18th,36th,54th elements.
>> >
>> >
>> > Was the global size of the vector you wrapped around the dense matrix 72*4?
>>
>> Yes it is. I set up its global size  to 72*4.
>>
>> >
>> > If you use CreateToAll(), it will make a vector on each process which has 
>> > the global size of the original vector.
>>
>> Although I set 72*4, the size of the vectors in each process is 72.
>
>
> You can understand how it is hard to accept, as this code is tested every 
> night. Can you VecView() the input vector
> to CreateToAll and the output vector,  and send that output?
>
>   Thanks,
>
>  Matt
>
>>
>> Thanks,
>>
>> Eda
>>
>> >
>> >   Thanks,
>> >
>> > Matt
>> >
>> >>
>> >> So, isn't scatter's goal is to scatter all values to all processors?
>> >>
>> >> Furthermore, I am trying to use my vectors in that way but isn't there
>> >> any possible way that I can reach my goal entirely?
>> >>
>> >> Thanks so much for your help,
>> >>
>> >> Eda
>> >>
>> >> Matthew Knepley , 10 Haz 2020 Çar, 18:11 tarihinde
>> >> şunu yazdı:
>> >> >
>> >> > On Wed, Jun 10, 2020 at 10:09 AM Eda Oktay  
>> >> > wrote:
>> >> >>
>> >> >> Dear Matt,
>> >> >>
>> >> >> I have one last question I believe. Up to creating a dense matrix I
>> >> >> did what you've suggested. Thank you so much for that.
>> >> >>
>> >> >> I created a new dense matrix. Now, how should I wrap each vector in a
>> >> >> MatDense again? I mean, what is wrapping vectors in a matrix? To put
>> >> >> each of them again as rows?
>> >> >
>> >> >
>> >> > I thought you need a dense matrix for something, since you started with 
>> >> > one. If you
>> >> > do not, just do VecGetArray() on the vector from CreateToAll and use 
>> >> > the values.
>> >> >
>> >> >   Thanks,
>> >> >
>> >> >  Matt
>> >> >
>> >> >>
>> >> >> Thanks!
>

Re: [petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-06-25 Thread Eda Oktay
Dear Richard,

>From now on, I am actually trying to write a parallel k-means
algorithm by using petsc routines (I don't have to use petsc but I
believe it will be easier) and I used the algorithm you mentioned
before about finding cluster centroids. However, something is
bothering me:

You said that by using MPI_Allreduce, I should "calculate the global
element wise sum of all the local sums and finally divide by the
number of members of that cluster to get the centroid."

But if I do it this way, I think each cluster centroid will be the
same, right? But when I read the k-means algorithm, I thought that
each cluster centroid should be different since elements in each
cluster are different.

Can you enlighten me?

Thanks!

Eda

Mills, Richard Tran , 30 Nis 2020 Per, 02:07
tarihinde şunu yazdı:
>
> Hi Eda,
>
> Thanks for your reply. I'm still trying to understand why you say you need to 
> duplicate the row vectors across all processes. When I have implemented 
> parallel k-means, I don't duplicate the row vectors. (This would be very 
> unscalable and largely defeat the point of doing this with MPI parallelism in 
> the first place.)
>
> Earlier in this email thread, you said that you have used Matlab to get 
> cluster IDs for each row vector. Are you trying to then use this information 
> to calculate the cluster centroids from inside your PETSc program? If so, you 
> can do this by having each MPI rank do the following: For cluster i in 0 to 
> (k-1), calculate the element-wise sum of all of the local rows that belong to 
> cluster i, then use MPI_Allreduce() to calculate the global elementwise sum 
> of all the local sums (this array will be replicated across all MPI ranks), 
> and finally divide by the number of members of that cluster to get the 
> centroid. Note that MPI_Allreduce() doesn't work on PETSc objects, but simple 
> arrays, so you'll want to use something like MatGetValues() or MatGetRow() to 
> access the elements of your row vectors.
>
> Let me know if I am misunderstanding what you are aiming to do, or if I am 
> misunderstanding something.
>
> It sounds like you would benefit from having some routines in PETSc to do 
> k-means (or other) clustering, by the way?
>
> Best regards,
> Richard
>
> On 4/29/20 3:47 AM, Eda Oktay wrote:
>
> Dear Richard,
>
> I am trying to use spectral clustering algorithm by using k-means clustering 
> algorithm at some point. I am doing this by producing a matrix consisting of 
> eigenvectors (of the adjacency matrix of the graph that I want to partition), 
> then forming row vectors of this matrix. This is the part that I am using 
> parallel vector. By using the output from k-means, I am trying to cluster 
> these row vectors. To cluster these vectors, I think I need all row vectors 
> in all processes. I wanted to use sequential vectors, however, I couldn't 
> find a different way that I form row vectors of a matrix.
>
> I am trying to use VecScatterCreateToAll, however, since my vector is 
> parallel crated by VecDuplicateVecs, my input is not in correct type, so I 
> get error. I still can't get how can I use this function in parallel vector 
> created by VecDuplicateVecs.
>
> Thank you all for your help.
>
> Eda
>
> Mills, Richard Tran , 7 Nis 2020 Sal, 01:51 tarihinde şunu 
> yazdı:
>>
>> Hi Eda,
>>
>> I think that you probably want to use VecScatter routines, as Junchao
>> has suggested, instead of the lower level star forest for this. I
>> believe that VecScatterCreateToZero() is what you want for the broadcast
>> problem you describe, in the second part of your question. I'm not sure
>> what you are trying to do in the first part. Taking a parallel vector
>> and then copying its entire contents to a sequential vector residing on
>> each process is not scalable, and a lot of the design that has gone into
>> PETSc is to prevent the user from ever needing to do things like that.
>> Can you please tell us what you intend to do with these sequential vectors?
>>
>> I'm also wondering why, later in your message, you say that you get
>> cluster assignments from Matlab, and then "to cluster row vectors
>> according to this information, all processors need to have all of the
>> row vectors". Do you mean you want to get all of the row vectors copied
>> onto all of the processors so that you can compute the cluster
>> centroids? If so, computing the cluster centroids can be done without
>> copying the row vectors onto all processors if you use a communication
>> operation like MPI_Allreduce().
>>
>> Lastly, let me add that I've done a fair amount of work implementing
>> clustering algorithms on distributed memory parallel mac

Re: [petsc-users] Create MATSEQAIJ from MATMPIAIJ

2020-06-22 Thread Eda Oktay
Oh okay, I misunderstood before. I will try that. Thanks!

Matthew Knepley , 22 Haz 2020 Pzt, 19:10 tarihinde
şunu yazdı:
>
> On Mon, Jun 22, 2020 at 11:39 AM Eda Oktay  wrote:
>>
>> Matthew Knepley , 22 Haz 2020 Pzt, 14:43 tarihinde
>> şunu yazdı:
>> >
>> > On Mon, Jun 22, 2020 at 7:14 AM Eda Oktay  wrote:
>> >>
>> >> Hello everyone,
>> >>
>> >> I am trying to find elements in off diagonal blocks of a parallel
>> >> sparse matrix. That is why, I want to use MatGetDiagonalBlock and from
>> >> the matrix I obtain, I want to obtain off diagonal elements by
>> >> subtracting it from my original matrix by using MatAXPY.
>> >>
>> >> However, since MatGetDiagonalBlock gives a sequential matrix and my
>> >> The original one is parallel, I can't use MatAXPY. That's why I want to
>> >> change the type of one of the matrices.
>> >>
>> >> How can I change a MATSEQAIJ to MATMPIAIJ or vice versa?
>> >
>> >
>> > I assume you want a parallel matrix with the element in the diagonal block 
>> > removed. I can think
>> > of at least two ways to do this which sound easier to me:
>> >
>> >   1) Make a copy and then zero out the diagonal block is a way similar to 
>> > MatChop: 
>> > https://www.mcs.anl.gov/petsc/petsc-current/src/mat/utils/axpy.c.html#MatChop
>>
>> I read MatChop before, however I couldn't understand how to decide
>> tolerance. What I understood from this function is to eliminate
>> entries less than a number which is set to be the tolerance. But the
>> entries in the diagonal blocks can be less than ones in offdiagonal
>> blocks. What am I missing?
>
>
> You _change_ the code. MatChop decides to make an element zero by looking at 
> how big it is. You would decide
> to make an element zero by looking at what column it is in.
>
>   Thanks,
>
>  Matt
>
>>
>> >
>> >   2) Use MatGetSubMatrix() and exclude any columns from the diagonal block 
>> > on each process.
>> >
>> >   Thanks,
>> >
>> >  Matt
>> >
>> >>
>> >> Thanks!
>> >
>> >
>> >
>> > --
>> > 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
>> >
>> > https://www.cse.buffalo.edu/~knepley/
>
>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/


Re: [petsc-users] Create MATSEQAIJ from MATMPIAIJ

2020-06-22 Thread Eda Oktay
Matthew Knepley , 22 Haz 2020 Pzt, 14:43 tarihinde
şunu yazdı:
>
> On Mon, Jun 22, 2020 at 7:14 AM Eda Oktay  wrote:
>>
>> Hello everyone,
>>
>> I am trying to find elements in off diagonal blocks of a parallel
>> sparse matrix. That is why, I want to use MatGetDiagonalBlock and from
>> the matrix I obtain, I want to obtain off diagonal elements by
>> subtracting it from my original matrix by using MatAXPY.
>>
>> However, since MatGetDiagonalBlock gives a sequential matrix and my
>> The original one is parallel, I can't use MatAXPY. That's why I want to
>> change the type of one of the matrices.
>>
>> How can I change a MATSEQAIJ to MATMPIAIJ or vice versa?
>
>
> I assume you want a parallel matrix with the element in the diagonal block 
> removed. I can think
> of at least two ways to do this which sound easier to me:
>
>   1) Make a copy and then zero out the diagonal block is a way similar to 
> MatChop: 
> https://www.mcs.anl.gov/petsc/petsc-current/src/mat/utils/axpy.c.html#MatChop

I read MatChop before, however I couldn't understand how to decide
tolerance. What I understood from this function is to eliminate
entries less than a number which is set to be the tolerance. But the
entries in the diagonal blocks can be less than ones in offdiagonal
blocks. What am I missing?

>
>   2) Use MatGetSubMatrix() and exclude any columns from the diagonal block on 
> each process.
>
>   Thanks,
>
>  Matt
>
>>
>> Thanks!
>
>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/


[petsc-users] Create MATSEQAIJ from MATMPIAIJ

2020-06-22 Thread Eda Oktay
Hello everyone,

I am trying to find elements in off diagonal blocks of a parallel
sparse matrix. That is why, I want to use MatGetDiagonalBlock and from
the matrix I obtain, I want to obtain off diagonal elements by
subtracting it from my original matrix by using MatAXPY.

However, since MatGetDiagonalBlock gives a sequential matrix and my
original one is parallel, I can't use MatAXPY. That's why I want to
change the type of one of the matrices.

How can I change a MATSEQAIJ to MATMPIAIJ or vice versa?

Thanks!


Re: [petsc-users] MatFindOffBlockDiagonalEntries error

2020-06-22 Thread Eda Oktay
I am so sorry for the inconvenience, the last error I sent you was a
different one, I forgot to change the codes. I am sending you the
actual error where I used MatFindOffBlockDiagonalEntries again in the
newest version.

[1]PETSC ERROR: - Error Message
--
[1]PETSC ERROR: Null argument, when expecting valid pointer
[2]PETSC ERROR: - Error Message
--
[2]PETSC ERROR: Null argument, when expecting valid pointer
[2]PETSC ERROR: Null Object: Parameter # 1
[2]PETSC ERROR: See
https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
shooting.
[2]PETSC ERROR: Petsc Release Version 3.13.2, Jun 02, 2020
[2]PETSC ERROR: [3]PETSC ERROR: - Error Message
--
[3]PETSC ERROR: Null argument, when expecting valid pointer
[3]PETSC ERROR: Null Object: Parameter # 1
[3]PETSC ERROR: See
https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
shooting.
[3]PETSC ERROR: Petsc Release Version 3.13.2, Jun 02, 2020
[3]PETSC ERROR:
./approx_cut_deneme_clustering_son_final_edgecut_without_parmetis on a
arch-linux2-c-debug named b342.wls.metu.edu.tr by edaoktay Mon Jun 22
12:11:44 2020
[1]PETSC ERROR: Null Object: Parameter # 1
[1]PETSC ERROR: See
https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
shooting.
[1]PETSC ERROR: Petsc Release Version 3.13.2, Jun 02, 2020
[1]PETSC ERROR:
./approx_cut_deneme_clustering_son_final_edgecut_without_parmetis on a
arch-linux2-c-debug named b342.wls.metu.edu.tr by edaoktay Mon Jun 22
12:11:44 2020
[1]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--download-mpich --download-openblas --download-slepc --download-metis
--download-parmetis --download-chaco --with-X=1
[1]PETSC ERROR: #1 ISGetSize() line 1101 in
/home/edaoktay/petsc-3.13.2/src/vec/is/is/interface/index.c
./approx_cut_deneme_clustering_son_final_edgecut_without_parmetis on a
arch-linux2-c-debug named b342.wls.metu.edu.tr by edaoktay Mon Jun 22
12:11:44 2020
[2]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--download-mpich --download-openblas --download-slepc --download-metis
--download-parmetis --download-chaco --with-X=1
[2]PETSC ERROR: #1 ISGetSize() line 1101 in
/home/edaoktay/petsc-3.13.2/src/vec/is/is/interface/index.c
[2]PETSC ERROR: [3]PETSC ERROR: Configure options --with-cc=gcc
--with-cxx=g++ --download-mpich --download-openblas --download-slepc
--download-metis --download-parmetis --download-chaco --with-X=1
[3]PETSC ERROR: #1 ISGetSize() line 1101 in
/home/edaoktay/petsc-3.13.2/src/vec/is/is/interface/index.c
[3]PETSC ERROR: #2 MatFindOffBlockDiagonalEntries_MPIAIJ() line 229 in
/home/edaoktay/petsc-3.13.2/src/mat/impls/aij/mpi/mpiaij.c
[1]PETSC ERROR: #2 MatFindOffBlockDiagonalEntries_MPIAIJ() line 229 in
/home/edaoktay/petsc-3.13.2/src/mat/impls/aij/mpi/mpiaij.c
[1]PETSC ERROR: #3 MatFindOffBlockDiagonalEntries() line 9824 in
/home/edaoktay/petsc-3.13.2/src/mat/interface/matrix.c
#2 MatFindOffBlockDiagonalEntries_MPIAIJ() line 229 in
/home/edaoktay/petsc-3.13.2/src/mat/impls/aij/mpi/mpiaij.c
[2]PETSC ERROR: #3 MatFindOffBlockDiagonalEntries() line 9824 in
/home/edaoktay/petsc-3.13.2/src/mat/interface/matrix.c
[3]PETSC ERROR: #3 MatFindOffBlockDiagonalEntries() line 9824 in
/home/edaoktay/petsc-3.13.2/src/mat/interface/matrix.c

I think this is again the same error when I used an older version.
Again, even though I am using a valid matrix and an index set, I don't
know why I am getting this error.

About the small test example, I couldn't understand what Junchao ment
but this is the first time I am trying to use this function and my
current matrix is quite small 72*72.

  Mat Ais;
  MatCreateSubMatrix(A,idUi,idUi,MAT_INITIAL_MATRIX,);
  ISSetPermutation(idUi);
  MatPermute(Ais,idUi,idUi,);
IS offd;
MatFindOffBlockDiagonalEntries(PL,);

My matrix PL is working, I know that since I viewed it before the
line: IS offd. And although it says null object for parameter 1,  I
believe that other lines below this error are about IS. Should I
create IS before using it in MatFindOffBlockDiagonalEntries?

Mark Adams , 19 Haz 2020 Cum, 20:37 tarihinde şunu yazdı:
>
> This is more useful and you are getting a new error. Maybe the old error is 
> fixed.
> It looks like you are trying to copy a matrix into another but they have 
> different communicators.  For example, one is created with MPI_COMM_WOLD and 
> the other with PETSC_COMM_WORLD.
>
> On Fri, Jun 19, 2020 at 12:48 PM Eda Oktay  wrote:
>>
>> Dear Mark,
>>
>> I updated Petsc and again, here's the error:
>>
>> [0]PETSC ERROR: - Error Message
>> --
>> [0]PETSC ERROR: Arguments must have same communicator

Re: [petsc-users] MatFindOffBlockDiagonalEntries error

2020-06-19 Thread Eda Oktay
() line 72 in
/home/edaoktay/petsc-3.13.2/src/mat/utils/axpy.c
#2 MatAXPY() line 72 in /home/edaoktay/petsc-3.13.2/src/mat/utils/axpy.c

Elapsed time: 2.5e-01

- Error Message
--
[2]PETSC ERROR: Arguments must have same communicators
[2]PETSC ERROR: Different communicators in the two objects: Argument #
1 and 2 flag 3
[2]PETSC ERROR: See
https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
shooting.
[2]PETSC ERROR: Petsc Release Version 3.13.2, Jun 02, 2020
[2]PETSC ERROR:
./approx_cut_deneme_clustering_son_final_edgecut_without_parmetis on a
arch-linux2-c-debug named b342.wls.metu.edu.tr by edaoktay Fri Jun 19
19:44:41 2020
[2]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--download-mpich --download-openblas --download-slepc --download-metis
--download-parmetis --download-chaco --with-X=1
[2]PETSC ERROR: #1 MatCopy() line 4044 in
/home/edaoktay/petsc-3.13.2/src/mat/interface/matrix.c
[2]PETSC ERROR: - Error Message
--
[2]PETSC ERROR: Nonconforming object sizes
[2]PETSC ERROR: Non conforming matrix add: global sizes 3 x 72, 3 x 72
[2]PETSC ERROR: See
https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
shooting.
[2]PETSC ERROR: Petsc Release Version 3.13.2, Jun 02, 2020
[2]PETSC ERROR:
./approx_cut_deneme_clustering_son_final_edgecut_without_parmetis on a
arch-linux2-c-debug named b342.wls.metu.edu.tr by edaoktay Fri Jun 19
19:44:41 2020
[2]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--download-mpich --download-openblas --download-slepc --download-metis
--download-parmetis --download-chaco --with-X=1
[2]PETSC ERROR: #2 MatAXPY() line 72 in
/home/edaoktay/petsc-3.13.2/src/mat/utils/axpy.c

What can be the reason?

Mark Adams , 19 Haz 2020 Cum, 18:41 tarihinde şunu yazdı:
>
> I don't know what is going on here. There was an update to this function 
> about a year ago, so that might fix your problem.
>
> We would need you to test with a current version.
>
> Mark
>
> On Fri, Jun 19, 2020 at 11:23 AM Eda Oktay  wrote:
>>
>> Hi all,
>>
>> I am trying to find off block diagonal entries of a matrix and I am
>> trying to use MatFindOffBlockDiagonalEntries. However, although my
>> matrix is not NULL, I am getting an error message as follows:
>>
>> 1]PETSC ERROR: - Error Message
>> --
>> [1]PETSC ERROR: [2]PETSC ERROR: - Error Message
>> --
>> [2]PETSC ERROR: Null argument, when expecting valid pointer
>> [2]PETSC ERROR: Null Object: Parameter # 1
>> [2]PETSC ERROR: See
>> http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
>> shooting.
>> [2]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019
>> [2]PETSC ERROR: [3]PETSC ERROR: - Error Message
>> --
>> [3]PETSC ERROR: Null argument, when expecting valid pointer
>> [3]PETSC ERROR: Null Object: Parameter # 1
>> [3]PETSC ERROR: See
>> http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
>> shooting.
>> [3]PETSC ERROR: Null argument, when expecting valid pointer
>> [1]PETSC ERROR: Null Object: Parameter # 1
>> [1]PETSC ERROR: See
>> http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
>> shooting.
>> [1]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019
>> [1]PETSC ERROR:
>> ./approx_cut_deneme_clustering_son_final_edgecut_without_parmetis on a
>> arch-linux2-c-debug named b342.wls.metu.edu.tr by edaoktay Fri Jun 19
>> 18:19:11 2020
>> [1]PETSC ERROR: Configure options --download-mpich --download-openblas
>> --download-slepc --download-metis --download-parmetis --download-chaco
>> --with-X=1
>> [1]PETSC ERROR: #1 ISGetSize() line 510 in
>> /home/edaoktay/petsc-3.11.1/src/vec/is/is/interface/index.c
>> [1]PETSC ERROR:
>> ./approx_cut_deneme_clustering_son_final_edgecut_without_parmetis on a
>> arch-linux2-c-debug named b342.wls.metu.edu.tr by edaoktay Fri Jun 19
>> 18:19:11 2020
>> [2]PETSC ERROR: Configure options --download-mpich --download-openblas
>> --download-slepc --download-metis --download-parmetis --download-chaco
>> --with-X=1
>> [2]PETSC ERROR: #1 ISGetSize() line 510 in
>> /home/edaoktay/petsc-3.11.1/src/vec/is/is/interface/index.c
>> [2]PETSC ERROR: #2 MatFindOffBlockDiagonalEntries_MPIAIJ() line 211 in
>> /home/edaoktay/petsc-3.11.1/src/mat/impls/aij/mpi/mpiaij.c
>> [2]PETSC ERROR: #2 MatFindOffBlockDiagonalEntries_MPIAIJ() line 211 in
>>

[petsc-users] MatFindOffBlockDiagonalEntries error

2020-06-19 Thread Eda Oktay
Hi all,

I am trying to find off block diagonal entries of a matrix and I am
trying to use MatFindOffBlockDiagonalEntries. However, although my
matrix is not NULL, I am getting an error message as follows:

1]PETSC ERROR: - Error Message
--
[1]PETSC ERROR: [2]PETSC ERROR: - Error Message
--
[2]PETSC ERROR: Null argument, when expecting valid pointer
[2]PETSC ERROR: Null Object: Parameter # 1
[2]PETSC ERROR: See
http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
shooting.
[2]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019
[2]PETSC ERROR: [3]PETSC ERROR: - Error Message
--
[3]PETSC ERROR: Null argument, when expecting valid pointer
[3]PETSC ERROR: Null Object: Parameter # 1
[3]PETSC ERROR: See
http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
shooting.
[3]PETSC ERROR: Null argument, when expecting valid pointer
[1]PETSC ERROR: Null Object: Parameter # 1
[1]PETSC ERROR: See
http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
shooting.
[1]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019
[1]PETSC ERROR:
./approx_cut_deneme_clustering_son_final_edgecut_without_parmetis on a
arch-linux2-c-debug named b342.wls.metu.edu.tr by edaoktay Fri Jun 19
18:19:11 2020
[1]PETSC ERROR: Configure options --download-mpich --download-openblas
--download-slepc --download-metis --download-parmetis --download-chaco
--with-X=1
[1]PETSC ERROR: #1 ISGetSize() line 510 in
/home/edaoktay/petsc-3.11.1/src/vec/is/is/interface/index.c
[1]PETSC ERROR:
./approx_cut_deneme_clustering_son_final_edgecut_without_parmetis on a
arch-linux2-c-debug named b342.wls.metu.edu.tr by edaoktay Fri Jun 19
18:19:11 2020
[2]PETSC ERROR: Configure options --download-mpich --download-openblas
--download-slepc --download-metis --download-parmetis --download-chaco
--with-X=1
[2]PETSC ERROR: #1 ISGetSize() line 510 in
/home/edaoktay/petsc-3.11.1/src/vec/is/is/interface/index.c
[2]PETSC ERROR: #2 MatFindOffBlockDiagonalEntries_MPIAIJ() line 211 in
/home/edaoktay/petsc-3.11.1/src/mat/impls/aij/mpi/mpiaij.c
[2]PETSC ERROR: #2 MatFindOffBlockDiagonalEntries_MPIAIJ() line 211 in
/home/edaoktay/petsc-3.11.1/src/mat/impls/aij/mpi/mpiaij.c
[1]PETSC ERROR: #3 MatFindOffBlockDiagonalEntries() line 10502 in
/home/edaoktay/petsc-3.11.1/src/mat/interface/matrix.c
#3 MatFindOffBlockDiagonalEntries() line 10502 in
/home/edaoktay/petsc-3.11.1/src/mat/interface/matrix.c
Petsc Release Version 3.11.1, Apr, 12, 2019
[3]PETSC ERROR:
./approx_cut_deneme_clustering_son_final_edgecut_without_parmetis on a
arch-linux2-c-debug named b342.wls.metu.edu.tr by edaoktay Fri Jun 19
18:19:11 2020
[3]PETSC ERROR: Configure options --download-mpich --download-openblas
--download-slepc --download-metis --download-parmetis --download-chaco
--with-X=1
[3]PETSC ERROR: #1 ISGetSize() line 510 in
/home/edaoktay/petsc-3.11.1/src/vec/is/is/interface/index.c
[3]PETSC ERROR: #2 MatFindOffBlockDiagonalEntries_MPIAIJ() line 211 in
/home/edaoktay/petsc-3.11.1/src/mat/impls/aij/mpi/mpiaij.c
[3]PETSC ERROR: #3 MatFindOffBlockDiagonalEntries() line 10502 in
/home/edaoktay/petsc-3.11.1/src/mat/interface/matrix.c

And the program is still running.

The part of my program is :

  Mat Ais;
  MatCreateSubMatrix(A,idUi,idUi,MAT_INITIAL_MATRIX,);
  ISSetPermutation(idUi);
  MatPermute(Ais,idUi,idUi,);
  IS offd;
  MatFindOffBlockDiagonalEntries(PL,);

Since there isn't any examples for this function, I couldn't
understand what should I do. Since it says in the error that it is
about parameter 1, the matrix, I don't know how to solve the problem.
My matrix PL is parallel sparse. I know there shouldn't be any problem
in PL since I can view PL by using MatView.

Thanks!

Eda


[petsc-users] Finding mincut after k-means clustering

2020-06-16 Thread Eda Oktay
Hello everyone,

I am solving a graph partitioning problem. I found an unnormalized
Laplacian matrix of a graph, then since I have 4 processes and I am
using spectral partitioning algorithm, I calculated 4 eigenvectors
corresponding to 4 smallest eigenvalues of this Laplacian matrix.

Then, since I am using the k-means clustering algorithm, I formed a
matrix U whose columns are these eigenvectors. After that, I clustered
each row of U according to the k-means algorithm. Now, I have
different row vectors at different processes, as I want.

In other words, my eigenvectors have 72 elements. So, right now, I
have 72 different row vectors with 4 elements. Those 72 row vectors
were clustered but not in a serial order. For instance, the 4th vector
is in the first process and the 5th one is in the 4th process.

As the last part of my work, I want to find mincut of this
partitioning but I couldn't understand how to do it. If I didn't use
k-means algorithm, I would use MatPartitioningApply but now, since I
clustered row vectors of U according to the index set I obtained from
k-means algorithm, I don't know how to use partitioning routines.
Should I form another matrix by reordering these vectors and then
partition? But then, how can I be sure the vectors stay in the same
process as before? Besides MatPartitioning routines, is there any
routine I can use for this? I thought MatColoring can work but I guess
it won't.

Thanks a lot!

Eda


Re: [petsc-users] MatGetRow for global rows of a parallel matrix

2020-06-10 Thread Eda Oktay
Matthew Knepley , 10 Haz 2020 Çar, 19:13 tarihinde
şunu yazdı:
>
> On Wed, Jun 10, 2020 at 12:07 PM Eda Oktay  wrote:
>>
>> Der Matt,
>>
>> When I looked at the results, I found that there are some problems I
>> couldn't understand.
>>
>> First of all, I am working on a 72*4 matrix and as I said before, I
>> want to have 72 different vectors having size 4 each, whose elements
>> consist of the elements in the same row. And of course, all vectors
>> should be in all processors (currently I am using 4 processors).
>>
>> When I use your scatter code, the output vector is divided into 4
>> parts for 4 processors and each vector consists of 18 row vectors
>> whose elements are arranged in a way that if I want to find zeroth row
>> vector, its elements are located in 0th,18th,36th,54th elements.
>
>
> Was the global size of the vector you wrapped around the dense matrix 72*4?

Yes it is. I set up its global size  to 72*4.

>
> If you use CreateToAll(), it will make a vector on each process which has the 
> global size of the original vector.

Although I set 72*4, the size of the vectors in each process is 72.

Thanks,

Eda

>
>   Thanks,
>
> Matt
>
>>
>> So, isn't scatter's goal is to scatter all values to all processors?
>>
>> Furthermore, I am trying to use my vectors in that way but isn't there
>> any possible way that I can reach my goal entirely?
>>
>> Thanks so much for your help,
>>
>> Eda
>>
>> Matthew Knepley , 10 Haz 2020 Çar, 18:11 tarihinde
>> şunu yazdı:
>> >
>> > On Wed, Jun 10, 2020 at 10:09 AM Eda Oktay  wrote:
>> >>
>> >> Dear Matt,
>> >>
>> >> I have one last question I believe. Up to creating a dense matrix I
>> >> did what you've suggested. Thank you so much for that.
>> >>
>> >> I created a new dense matrix. Now, how should I wrap each vector in a
>> >> MatDense again? I mean, what is wrapping vectors in a matrix? To put
>> >> each of them again as rows?
>> >
>> >
>> > I thought you need a dense matrix for something, since you started with 
>> > one. If you
>> > do not, just do VecGetArray() on the vector from CreateToAll and use the 
>> > values.
>> >
>> >   Thanks,
>> >
>> >  Matt
>> >
>> >>
>> >> Thanks!
>> >>
>> >> Eda
>> >>
>> >> Matthew Knepley , 10 Haz 2020 Çar, 16:16 tarihinde
>> >> şunu yazdı:
>> >> >
>> >> > On Wed, Jun 10, 2020 at 9:08 AM Eda Oktay  wrote:
>> >> >>
>> >> >> Dear Matt,
>> >> >>
>> >> >> Matthew Knepley , 10 Haz 2020 Çar, 16:03 tarihinde
>> >> >> şunu yazdı:
>> >> >> >
>> >> >> > On Wed, Jun 10, 2020 at 8:56 AM Eda Oktay  
>> >> >> > wrote:
>> >> >> >>
>> >> >> >> Hi all,
>> >> >> >>
>> >> >> >> I am trying to get all the rows of a parallel matrix as individual
>> >> >> >> vectors. For instance, if I have 72*4 matrix, I want to get 72
>> >> >> >> different vectors having size 4.
>> >> >> >>
>> >> >> >> As far as I understood, MatGetRow is only for local rows, so
>> >> >> >> MatGetOwnershipRange is used, however, when I tried this one, I
>> >> >> >> couldn't get the whole and desired row vectors.
>> >> >> >>
>> >> >> >> In MatGetRow explanation, it is written that I should use
>> >> >> >> MatCreateSubMatrices first, then use MatGetRow. But I couldn't
>> >> >> >> understand to which extent I should create submatrices. I just need 
>> >> >> >> to
>> >> >> >> have all 72 rows as 72 different vectors each having 4 elements.
>> >> >> >
>> >> >> >
>> >> >> > 1) For sparse matrices, the storage is always divided by row, so 
>> >> >> > that values can only be retrieved for local rows with MatGetRow()
>> >> >> >
>> >> >> > 2) Is this matrix sparse? It sounds like it is dense.
>> >> >>
>> >> >> Matrix is dense.
>> >> >>
>> >> >> >
>> >> >> > 3) Are you asking to get all matrix values on

Re: [petsc-users] MatGetRow for global rows of a parallel matrix

2020-06-10 Thread Eda Oktay
Der Matt,

When I looked at the results, I found that there are some problems I
couldn't understand.

First of all, I am working on a 72*4 matrix and as I said before, I
want to have 72 different vectors having size 4 each, whose elements
consist of the elements in the same row. And of course, all vectors
should be in all processors (currently I am using 4 processors).

When I use your scatter code, the output vector is divided into 4
parts for 4 processors and each vector consists of 18 row vectors
whose elements are arranged in a way that if I want to find zeroth row
vector, its elements are located in 0th,18th,36th,54th elements.

So, isn't scatter's goal is to scatter all values to all processors?

Furthermore, I am trying to use my vectors in that way but isn't there
any possible way that I can reach my goal entirely?

Thanks so much for your help,

Eda

Matthew Knepley , 10 Haz 2020 Çar, 18:11 tarihinde
şunu yazdı:
>
> On Wed, Jun 10, 2020 at 10:09 AM Eda Oktay  wrote:
>>
>> Dear Matt,
>>
>> I have one last question I believe. Up to creating a dense matrix I
>> did what you've suggested. Thank you so much for that.
>>
>> I created a new dense matrix. Now, how should I wrap each vector in a
>> MatDense again? I mean, what is wrapping vectors in a matrix? To put
>> each of them again as rows?
>
>
> I thought you need a dense matrix for something, since you started with one. 
> If you
> do not, just do VecGetArray() on the vector from CreateToAll and use the 
> values.
>
>   Thanks,
>
>  Matt
>
>>
>> Thanks!
>>
>> Eda
>>
>> Matthew Knepley , 10 Haz 2020 Çar, 16:16 tarihinde
>> şunu yazdı:
>> >
>> > On Wed, Jun 10, 2020 at 9:08 AM Eda Oktay  wrote:
>> >>
>> >> Dear Matt,
>> >>
>> >> Matthew Knepley , 10 Haz 2020 Çar, 16:03 tarihinde
>> >> şunu yazdı:
>> >> >
>> >> > On Wed, Jun 10, 2020 at 8:56 AM Eda Oktay  wrote:
>> >> >>
>> >> >> Hi all,
>> >> >>
>> >> >> I am trying to get all the rows of a parallel matrix as individual
>> >> >> vectors. For instance, if I have 72*4 matrix, I want to get 72
>> >> >> different vectors having size 4.
>> >> >>
>> >> >> As far as I understood, MatGetRow is only for local rows, so
>> >> >> MatGetOwnershipRange is used, however, when I tried this one, I
>> >> >> couldn't get the whole and desired row vectors.
>> >> >>
>> >> >> In MatGetRow explanation, it is written that I should use
>> >> >> MatCreateSubMatrices first, then use MatGetRow. But I couldn't
>> >> >> understand to which extent I should create submatrices. I just need to
>> >> >> have all 72 rows as 72 different vectors each having 4 elements.
>> >> >
>> >> >
>> >> > 1) For sparse matrices, the storage is always divided by row, so that 
>> >> > values can only be retrieved for local rows with MatGetRow()
>> >> >
>> >> > 2) Is this matrix sparse? It sounds like it is dense.
>> >>
>> >> Matrix is dense.
>> >>
>> >> >
>> >> > 3) Are you asking to get all matrix values on all processes? If so, I 
>> >> > think the easiest thing to do is first wrap a Vec around the
>> >> > values, then use VecScatterToAll(), then wrap each one in a 
>> >> > MatDense again.
>> >>
>> >> Yes, I want all row vectors on all processes. In a dense matrix,
>> >> should I still wrap a Vec around the values? I know I should use
>> >> scatter but I couldn't even wrap a Vec around them.
>> >
>> >
>> > I would do
>> >
>> >   MatGetSize();
>> >   MatGetLocalSize();
>> >   
>> > https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatDenseGetArray.html
>> >   
>> >   
>> > https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecPlaceArray.html
>> >   
>> > https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecScatterCreateToAll.html
>> >   
>> >   
>> > https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecResetArray.html#VecResetArray
>> >   
>> > https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateDense.html
>> >   
>> >   
>> >   
>> >
>> >   Thanks,
>> >
>> >  Matt
>> >
>> >>
>> >> Thanks so much!
>> >>
>> >> Eda
>> >>
>> >> >
>> >> >   Thanks,
>> >> >
>> >> >  Matt
>> >> >
>> >> >>
>> >> >> Thanks!
>> >> >>
>> >> >> Eda
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > 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
>> >> >
>> >> > https://www.cse.buffalo.edu/~knepley/
>> >
>> >
>> >
>> > --
>> > 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
>> >
>> > https://www.cse.buffalo.edu/~knepley/
>
>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/


Re: [petsc-users] MatGetRow for global rows of a parallel matrix

2020-06-10 Thread Eda Oktay
Dear Matt,

I have one last question I believe. Up to creating a dense matrix I
did what you've suggested. Thank you so much for that.

I created a new dense matrix. Now, how should I wrap each vector in a
MatDense again? I mean, what is wrapping vectors in a matrix? To put
each of them again as rows?

Thanks!

Eda

Matthew Knepley , 10 Haz 2020 Çar, 16:16 tarihinde
şunu yazdı:
>
> On Wed, Jun 10, 2020 at 9:08 AM Eda Oktay  wrote:
>>
>> Dear Matt,
>>
>> Matthew Knepley , 10 Haz 2020 Çar, 16:03 tarihinde
>> şunu yazdı:
>> >
>> > On Wed, Jun 10, 2020 at 8:56 AM Eda Oktay  wrote:
>> >>
>> >> Hi all,
>> >>
>> >> I am trying to get all the rows of a parallel matrix as individual
>> >> vectors. For instance, if I have 72*4 matrix, I want to get 72
>> >> different vectors having size 4.
>> >>
>> >> As far as I understood, MatGetRow is only for local rows, so
>> >> MatGetOwnershipRange is used, however, when I tried this one, I
>> >> couldn't get the whole and desired row vectors.
>> >>
>> >> In MatGetRow explanation, it is written that I should use
>> >> MatCreateSubMatrices first, then use MatGetRow. But I couldn't
>> >> understand to which extent I should create submatrices. I just need to
>> >> have all 72 rows as 72 different vectors each having 4 elements.
>> >
>> >
>> > 1) For sparse matrices, the storage is always divided by row, so that 
>> > values can only be retrieved for local rows with MatGetRow()
>> >
>> > 2) Is this matrix sparse? It sounds like it is dense.
>>
>> Matrix is dense.
>>
>> >
>> > 3) Are you asking to get all matrix values on all processes? If so, I 
>> > think the easiest thing to do is first wrap a Vec around the
>> > values, then use VecScatterToAll(), then wrap each one in a MatDense 
>> > again.
>>
>> Yes, I want all row vectors on all processes. In a dense matrix,
>> should I still wrap a Vec around the values? I know I should use
>> scatter but I couldn't even wrap a Vec around them.
>
>
> I would do
>
>   MatGetSize();
>   MatGetLocalSize();
>   
> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatDenseGetArray.html
>   
>   
> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecPlaceArray.html
>   
> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecScatterCreateToAll.html
>   
>   
> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecResetArray.html#VecResetArray
>   
> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateDense.html
>   
>   
>   
>
>   Thanks,
>
>  Matt
>
>>
>> Thanks so much!
>>
>> Eda
>>
>> >
>> >   Thanks,
>> >
>> >  Matt
>> >
>> >>
>> >> Thanks!
>> >>
>> >> Eda
>> >
>> >
>> >
>> > --
>> > 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
>> >
>> > https://www.cse.buffalo.edu/~knepley/
>
>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/


Re: [petsc-users] MatGetRow for global rows of a parallel matrix

2020-06-10 Thread Eda Oktay
Dear Matt,

Matthew Knepley , 10 Haz 2020 Çar, 16:03 tarihinde
şunu yazdı:
>
> On Wed, Jun 10, 2020 at 8:56 AM Eda Oktay  wrote:
>>
>> Hi all,
>>
>> I am trying to get all the rows of a parallel matrix as individual
>> vectors. For instance, if I have 72*4 matrix, I want to get 72
>> different vectors having size 4.
>>
>> As far as I understood, MatGetRow is only for local rows, so
>> MatGetOwnershipRange is used, however, when I tried this one, I
>> couldn't get the whole and desired row vectors.
>>
>> In MatGetRow explanation, it is written that I should use
>> MatCreateSubMatrices first, then use MatGetRow. But I couldn't
>> understand to which extent I should create submatrices. I just need to
>> have all 72 rows as 72 different vectors each having 4 elements.
>
>
> 1) For sparse matrices, the storage is always divided by row, so that values 
> can only be retrieved for local rows with MatGetRow()
>
> 2) Is this matrix sparse? It sounds like it is dense.

Matrix is dense.

>
> 3) Are you asking to get all matrix values on all processes? If so, I think 
> the easiest thing to do is first wrap a Vec around the
> values, then use VecScatterToAll(), then wrap each one in a MatDense 
> again.

Yes, I want all row vectors on all processes. In a dense matrix,
should I still wrap a Vec around the values? I know I should use
scatter but I couldn't even wrap a Vec around them.

Thanks so much!

Eda

>
>   Thanks,
>
>  Matt
>
>>
>> Thanks!
>>
>> Eda
>
>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/


[petsc-users] MatGetRow for global rows of a parallel matrix

2020-06-10 Thread Eda Oktay
Hi all,

I am trying to get all the rows of a parallel matrix as individual
vectors. For instance, if I have 72*4 matrix, I want to get 72
different vectors having size 4.

As far as I understood, MatGetRow is only for local rows, so
MatGetOwnershipRange is used, however, when I tried this one, I
couldn't get the whole and desired row vectors.

In MatGetRow explanation, it is written that I should use
MatCreateSubMatrices first, then use MatGetRow. But I couldn't
understand to which extent I should create submatrices. I just need to
have all 72 rows as 72 different vectors each having 4 elements.

Thanks!

Eda


Re: [petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-05-26 Thread Eda Oktay
Dear Richard,

I believe I don't need centroids. I just need cluster indices which
corresponds to idx.

What I am trying to do is this:

Step 6: Cluster the points (y_i) i=1,...,n in R^k with the k-means
algorithm into clusters C_1,...,C_k.
Output: Clusters A_1,,A_k with A_i = {j | y_j in C_i}

where y_i is the row vector of a matrix whose columns are eigenvectors

In order to cluster y_i, I think I just need idx from MATLAB since it shows
clustering indices.

Thanks,

Eda

Mills, Richard Tran , 23 May 2020 Cmt, 02:39 tarihinde
şunu yazdı:

> Hi Eda,
>
> If you are using the MATLAB k-means function, calling it like
>
>   idx = kmeans(X,k)
>
> will give you the index set, but if you do
>
>   [idx,C] = kmeans(X,k)
>
> then you will also get a matrix C which contains the cluster centroids. Is
> this not what you need?
>
> --Richard
>
> On 5/22/20 10:38 AM, Eda Oktay wrote:
>
> I am sorry, I used VecDuplictaeVecs not MatDuplicateVecs
>
> Eda Oktay , 22 May 2020 Cum, 20:31 tarihinde şunu
> yazdı:
>
>> Dear Richard,
>>
>> Thank you for your email. From MATLAB's kmeans() function I believe I got
>> the final clustering index set, not centroids. What I am trying to do is to
>> cluster vectors created by MatDuplicateVecs() according to the index set
>> (whose type is not IS since I took it from MATLAB) that I obtained from
>> MATLAB. I am trying to cluster these vectors however since they are
>> parallel, I couldn't understand how to cluster them.
>>
>> Normally, I have to be independent from MATLAB so I will try your
>> suggestion, grateful for that. However, because of my limited
>> knowledge about PETSc and parallel computing, I am not able to figure out
>> how to cluster parallel vectors according to an index set.
>>
>> Thanks,
>>
>> Eda
>>
>> Mills, Richard Tran , 30 Nis 2020 Per, 02:07 tarihinde
>> şunu yazdı:
>>
>>> Hi Eda,
>>>
>>> Thanks for your reply. I'm still trying to understand why you say you
>>> need to duplicate the row vectors across all processes. When I have
>>> implemented parallel k-means, I don't duplicate the row vectors. (This
>>> would be very unscalable and largely defeat the point of doing this with
>>> MPI parallelism in the first place.)
>>>
>>> Earlier in this email thread, you said that you have used Matlab to get
>>> cluster IDs for each row vector. Are you trying to then use this
>>> information to calculate the cluster centroids from inside your PETSc
>>> program? If so, you can do this by having each MPI rank do the following:
>>> For cluster i in 0 to (k-1), calculate the element-wise sum of all of the
>>> local rows that belong to cluster i, then use MPI_Allreduce() to calculate
>>> the global elementwise sum of all the local sums (this array will be
>>> replicated across all MPI ranks), and finally divide by the number of
>>> members of that cluster to get the centroid. Note that MPI_Allreduce()
>>> doesn't work on PETSc objects, but simple arrays, so you'll want to use
>>> something like MatGetValues() or MatGetRow() to access the elements of your
>>> row vectors.
>>>
>>> Let me know if I am misunderstanding what you are aiming to do, or if I
>>> am misunderstanding something.
>>>
>>> It sounds like you would benefit from having some routines in PETSc to
>>> do k-means (or other) clustering, by the way?
>>>
>>> Best regards,
>>> Richard
>>>
>>> On 4/29/20 3:47 AM, Eda Oktay wrote:
>>>
>>> Dear Richard,
>>>
>>> I am trying to use spectral clustering algorithm by using k-means
>>> clustering algorithm at some point. I am doing this by producing a matrix
>>> consisting of eigenvectors (of the adjacency matrix of the graph that I
>>> want to partition), then forming row vectors of this matrix. This is the
>>> part that I am using parallel vector. By using the output from k-means, I
>>> am trying to cluster these row vectors. To cluster these vectors, I think I
>>> need all row vectors in all processes. I wanted to use sequential vectors,
>>> however, I couldn't find a different way that I form row vectors of a
>>> matrix.
>>>
>>> I am trying to use VecScatterCreateToAll, however, since my vector is
>>> parallel crated by VecDuplicateVecs, my input is not in correct type, so I
>>> get error. I still can't get how can I use this function in parallel vector
>>> created by VecDuplicateVecs.
>>>
>>> Thank you all for your help.
>>>
>>

Re: [petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-05-22 Thread Eda Oktay
I am sorry, I used VecDuplictaeVecs not MatDuplicateVecs

Eda Oktay , 22 May 2020 Cum, 20:31 tarihinde şunu
yazdı:

> Dear Richard,
>
> Thank you for your email. From MATLAB's kmeans() function I believe I got
> the final clustering index set, not centroids. What I am trying to do is to
> cluster vectors created by MatDuplicateVecs() according to the index set
> (whose type is not IS since I took it from MATLAB) that I obtained from
> MATLAB. I am trying to cluster these vectors however since they are
> parallel, I couldn't understand how to cluster them.
>
> Normally, I have to be independent from MATLAB so I will try your
> suggestion, grateful for that. However, because of my limited
> knowledge about PETSc and parallel computing, I am not able to figure out
> how to cluster parallel vectors according to an index set.
>
> Thanks,
>
> Eda
>
> Mills, Richard Tran , 30 Nis 2020 Per, 02:07 tarihinde
> şunu yazdı:
>
>> Hi Eda,
>>
>> Thanks for your reply. I'm still trying to understand why you say you
>> need to duplicate the row vectors across all processes. When I have
>> implemented parallel k-means, I don't duplicate the row vectors. (This
>> would be very unscalable and largely defeat the point of doing this with
>> MPI parallelism in the first place.)
>>
>> Earlier in this email thread, you said that you have used Matlab to get
>> cluster IDs for each row vector. Are you trying to then use this
>> information to calculate the cluster centroids from inside your PETSc
>> program? If so, you can do this by having each MPI rank do the following:
>> For cluster i in 0 to (k-1), calculate the element-wise sum of all of the
>> local rows that belong to cluster i, then use MPI_Allreduce() to calculate
>> the global elementwise sum of all the local sums (this array will be
>> replicated across all MPI ranks), and finally divide by the number of
>> members of that cluster to get the centroid. Note that MPI_Allreduce()
>> doesn't work on PETSc objects, but simple arrays, so you'll want to use
>> something like MatGetValues() or MatGetRow() to access the elements of your
>> row vectors.
>>
>> Let me know if I am misunderstanding what you are aiming to do, or if I
>> am misunderstanding something.
>>
>> It sounds like you would benefit from having some routines in PETSc to do
>> k-means (or other) clustering, by the way?
>>
>> Best regards,
>> Richard
>>
>> On 4/29/20 3:47 AM, Eda Oktay wrote:
>>
>> Dear Richard,
>>
>> I am trying to use spectral clustering algorithm by using k-means
>> clustering algorithm at some point. I am doing this by producing a matrix
>> consisting of eigenvectors (of the adjacency matrix of the graph that I
>> want to partition), then forming row vectors of this matrix. This is the
>> part that I am using parallel vector. By using the output from k-means, I
>> am trying to cluster these row vectors. To cluster these vectors, I think I
>> need all row vectors in all processes. I wanted to use sequential vectors,
>> however, I couldn't find a different way that I form row vectors of a
>> matrix.
>>
>> I am trying to use VecScatterCreateToAll, however, since my vector is
>> parallel crated by VecDuplicateVecs, my input is not in correct type, so I
>> get error. I still can't get how can I use this function in parallel vector
>> created by VecDuplicateVecs.
>>
>> Thank you all for your help.
>>
>> Eda
>>
>> Mills, Richard Tran , 7 Nis 2020 Sal, 01:51 tarihinde
>> şunu yazdı:
>>
>>> Hi Eda,
>>>
>>> I think that you probably want to use VecScatter routines, as Junchao
>>> has suggested, instead of the lower level star forest for this. I
>>> believe that VecScatterCreateToZero() is what you want for the broadcast
>>> problem you describe, in the second part of your question. I'm not sure
>>> what you are trying to do in the first part. Taking a parallel vector
>>> and then copying its entire contents to a sequential vector residing on
>>> each process is not scalable, and a lot of the design that has gone into
>>> PETSc is to prevent the user from ever needing to do things like that.
>>> Can you please tell us what you intend to do with these sequential
>>> vectors?
>>>
>>> I'm also wondering why, later in your message, you say that you get
>>> cluster assignments from Matlab, and then "to cluster row vectors
>>> according to this information, all processors need to have all of the
>>> row vectors". Do you mean you want to get all of th

Re: [petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-05-22 Thread Eda Oktay
Dear Richard,

Thank you for your email. From MATLAB's kmeans() function I believe I got
the final clustering index set, not centroids. What I am trying to do is to
cluster vectors created by MatDuplicateVecs() according to the index set
(whose type is not IS since I took it from MATLAB) that I obtained from
MATLAB. I am trying to cluster these vectors however since they are
parallel, I couldn't understand how to cluster them.

Normally, I have to be independent from MATLAB so I will try your
suggestion, grateful for that. However, because of my limited
knowledge about PETSc and parallel computing, I am not able to figure out
how to cluster parallel vectors according to an index set.

Thanks,

Eda

Mills, Richard Tran , 30 Nis 2020 Per, 02:07 tarihinde
şunu yazdı:

> Hi Eda,
>
> Thanks for your reply. I'm still trying to understand why you say you need
> to duplicate the row vectors across all processes. When I have implemented
> parallel k-means, I don't duplicate the row vectors. (This would be very
> unscalable and largely defeat the point of doing this with MPI parallelism
> in the first place.)
>
> Earlier in this email thread, you said that you have used Matlab to get
> cluster IDs for each row vector. Are you trying to then use this
> information to calculate the cluster centroids from inside your PETSc
> program? If so, you can do this by having each MPI rank do the following:
> For cluster i in 0 to (k-1), calculate the element-wise sum of all of the
> local rows that belong to cluster i, then use MPI_Allreduce() to calculate
> the global elementwise sum of all the local sums (this array will be
> replicated across all MPI ranks), and finally divide by the number of
> members of that cluster to get the centroid. Note that MPI_Allreduce()
> doesn't work on PETSc objects, but simple arrays, so you'll want to use
> something like MatGetValues() or MatGetRow() to access the elements of your
> row vectors.
>
> Let me know if I am misunderstanding what you are aiming to do, or if I am
> misunderstanding something.
>
> It sounds like you would benefit from having some routines in PETSc to do
> k-means (or other) clustering, by the way?
>
> Best regards,
> Richard
>
> On 4/29/20 3:47 AM, Eda Oktay wrote:
>
> Dear Richard,
>
> I am trying to use spectral clustering algorithm by using k-means
> clustering algorithm at some point. I am doing this by producing a matrix
> consisting of eigenvectors (of the adjacency matrix of the graph that I
> want to partition), then forming row vectors of this matrix. This is the
> part that I am using parallel vector. By using the output from k-means, I
> am trying to cluster these row vectors. To cluster these vectors, I think I
> need all row vectors in all processes. I wanted to use sequential vectors,
> however, I couldn't find a different way that I form row vectors of a
> matrix.
>
> I am trying to use VecScatterCreateToAll, however, since my vector is
> parallel crated by VecDuplicateVecs, my input is not in correct type, so I
> get error. I still can't get how can I use this function in parallel vector
> created by VecDuplicateVecs.
>
> Thank you all for your help.
>
> Eda
>
> Mills, Richard Tran , 7 Nis 2020 Sal, 01:51 tarihinde
> şunu yazdı:
>
>> Hi Eda,
>>
>> I think that you probably want to use VecScatter routines, as Junchao
>> has suggested, instead of the lower level star forest for this. I
>> believe that VecScatterCreateToZero() is what you want for the broadcast
>> problem you describe, in the second part of your question. I'm not sure
>> what you are trying to do in the first part. Taking a parallel vector
>> and then copying its entire contents to a sequential vector residing on
>> each process is not scalable, and a lot of the design that has gone into
>> PETSc is to prevent the user from ever needing to do things like that.
>> Can you please tell us what you intend to do with these sequential
>> vectors?
>>
>> I'm also wondering why, later in your message, you say that you get
>> cluster assignments from Matlab, and then "to cluster row vectors
>> according to this information, all processors need to have all of the
>> row vectors". Do you mean you want to get all of the row vectors copied
>> onto all of the processors so that you can compute the cluster
>> centroids? If so, computing the cluster centroids can be done without
>> copying the row vectors onto all processors if you use a communication
>> operation like MPI_Allreduce().
>>
>> Lastly, let me add that I've done a fair amount of work implementing
>> clustering algorithms on distributed memory parallel machines, but
>> outside of PETSc. I was thinking that I should i

Re: [petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-04-29 Thread Eda Oktay
Dear Richard,

I am trying to use spectral clustering algorithm by using k-means
clustering algorithm at some point. I am doing this by producing a matrix
consisting of eigenvectors (of the adjacency matrix of the graph that I
want to partition), then forming row vectors of this matrix. This is the
part that I am using parallel vector. By using the output from k-means, I
am trying to cluster these row vectors. To cluster these vectors, I think I
need all row vectors in all processes. I wanted to use sequential vectors,
however, I couldn't find a different way that I form row vectors of a
matrix.

I am trying to use VecScatterCreateToAll, however, since my vector is
parallel crated by VecDuplicateVecs, my input is not in correct type, so I
get error. I still can't get how can I use this function in parallel vector
created by VecDuplicateVecs.

Thank you all for your help.

Eda

Mills, Richard Tran , 7 Nis 2020 Sal, 01:51 tarihinde şunu
yazdı:

> Hi Eda,
>
> I think that you probably want to use VecScatter routines, as Junchao
> has suggested, instead of the lower level star forest for this. I
> believe that VecScatterCreateToZero() is what you want for the broadcast
> problem you describe, in the second part of your question. I'm not sure
> what you are trying to do in the first part. Taking a parallel vector
> and then copying its entire contents to a sequential vector residing on
> each process is not scalable, and a lot of the design that has gone into
> PETSc is to prevent the user from ever needing to do things like that.
> Can you please tell us what you intend to do with these sequential vectors?
>
> I'm also wondering why, later in your message, you say that you get
> cluster assignments from Matlab, and then "to cluster row vectors
> according to this information, all processors need to have all of the
> row vectors". Do you mean you want to get all of the row vectors copied
> onto all of the processors so that you can compute the cluster
> centroids? If so, computing the cluster centroids can be done without
> copying the row vectors onto all processors if you use a communication
> operation like MPI_Allreduce().
>
> Lastly, let me add that I've done a fair amount of work implementing
> clustering algorithms on distributed memory parallel machines, but
> outside of PETSc. I was thinking that I should implement some of these
> routines using PETSc. I can't get to this immediately, but I'm wondering
> if you might care to tell me a bit more about the clustering problems
> you need to solve and how having some support for this in PETSc might
> (or might not) help.
>
> Best regards,
> Richard
>
> On 4/4/20 1:39 AM, Eda Oktay wrote:
> > Hi all,
> >
> > I created a parallel vector UV, by using VecDuplicateVecs since I need
> > row vectors of a matrix. However, I need the whole vector be in all
> > processors, which means I need to gather all and broadcast them to all
> > processors. To gather, I tried to use VecStrideGatherAll:
> >
> >   Vec UVG;
> >   VecStrideGatherAll(UV,UVG,INSERT_VALUES);
> >   VecView(UVG,PETSC_VIEWER_STDOUT_WORLD);
> >
> >  however when I try to view the vector, I get the following error.
> >
> > [3]PETSC ERROR: Invalid argument
> > [3]PETSC ERROR: Wrong type of object: Parameter # 1
> > [3]PETSC ERROR: See
> > http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
> shooting.
> > [3]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019
> > [3]PETSC ERROR: ./clustering_son_final_edgecut_without_parmetis on a
> > arch-linux2-c-debug named localhost.localdomain by edaoktay Sat Apr  4
> > 11:22:54 2020
> > [3]PETSC ERROR: Wrong type of object: Parameter # 1
> > [0]PETSC ERROR: See
> > http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
> shooting.
> > [0]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019
> > [0]PETSC ERROR: ./clustering_son_final_edgecut_without_parmetis on a
> > arch-linux2-c-debug named localhost.localdomain by edaoktay Sat Apr  4
> > 11:22:54 2020
> > [0]PETSC ERROR: Configure options --download-mpich --download-openblas
> > --download-slepc --download-metis --download-parmetis --download-chaco
> > --with-X=1
> > [0]PETSC ERROR: #1 VecStrideGatherAll() line 646 in
> > /home/edaoktay/petsc-3.11.1/src/vec/vec/utils/vinv.c
> > ./clustering_son_final_edgecut_without_parmetis on a
> > arch-linux2-c-debug named localhost.localdomain by edaoktay Sat Apr  4
> > 11:22:54 2020
> > [1]PETSC ERROR: Configure options --download-mpich --download-openblas
> > --download-slepc --download-metis --download-parmetis --download-chaco
> > --with-X=1
> > [1]PETSC ERROR: #1 VecStrideGatherAll() line 646 in

[petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-04-04 Thread Eda Oktay
Hi all,

I created a parallel vector UV, by using VecDuplicateVecs since I need row
vectors of a matrix. However, I need the whole vector be in all processors,
which means I need to gather all and broadcast them to all processors. To
gather, I tried to use VecStrideGatherAll:

  Vec UVG;
  VecStrideGatherAll(UV,UVG,INSERT_VALUES);
  VecView(UVG,PETSC_VIEWER_STDOUT_WORLD);

 however when I try to view the vector, I get the following error.

[3]PETSC ERROR: Invalid argument
[3]PETSC ERROR: Wrong type of object: Parameter # 1
[3]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for
trouble shooting.
[3]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019
[3]PETSC ERROR: ./clustering_son_final_edgecut_without_parmetis on a
arch-linux2-c-debug named localhost.localdomain by edaoktay Sat Apr  4
11:22:54 2020
[3]PETSC ERROR: Wrong type of object: Parameter # 1
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for
trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019
[0]PETSC ERROR: ./clustering_son_final_edgecut_without_parmetis on a
arch-linux2-c-debug named localhost.localdomain by edaoktay Sat Apr  4
11:22:54 2020
[0]PETSC ERROR: Configure options --download-mpich --download-openblas
--download-slepc --download-metis --download-parmetis --download-chaco
--with-X=1
[0]PETSC ERROR: #1 VecStrideGatherAll() line 646 in
/home/edaoktay/petsc-3.11.1/src/vec/vec/utils/vinv.c
./clustering_son_final_edgecut_without_parmetis on a arch-linux2-c-debug
named localhost.localdomain by edaoktay Sat Apr  4 11:22:54 2020
[1]PETSC ERROR: Configure options --download-mpich --download-openblas
--download-slepc --download-metis --download-parmetis --download-chaco
--with-X=1
[1]PETSC ERROR: #1 VecStrideGatherAll() line 646 in
/home/edaoktay/petsc-3.11.1/src/vec/vec/utils/vinv.c
Configure options --download-mpich --download-openblas --download-slepc
--download-metis --download-parmetis --download-chaco --with-X=1
[3]PETSC ERROR: #1 VecStrideGatherAll() line 646 in
/home/edaoktay/petsc-3.11.1/src/vec/vec/utils/vinv.c

I couldn't understand why I am getting this error. Is this because of UV
being created by VecDuplicateVecs? How can I solve this problem?

The other question is broadcasting. After gathering all elements of the
vector UV, I need to broadcast them to all processors. I found
PetscSFBcastBegin. However, I couldn't understand the PetscSF concept
properly. I couldn't adjust my question to the star forest concept.

My problem is: If I have 4 processors, I create a matrix whose columns are
4 smallest eigenvectors, say of size 72. Then by defining each row of this
matrix as a vector, I cluster them by using k-means clustering algorithm.
For now, I cluster them by using MATLAB and I obtain a vector showing which
row vector is in which cluster. After getting this vector, to cluster row
vectors according to this information, all processors need to have all of
the row vectors.

According to this problem, how can I use the star forest concept?

I will be glad if you can help me about this problem since I don't have
enough knowledge about graph theory. An if you have any idea about how can
I use k-means algorithm in a more practical way, please let me know.

Thanks!

Eda


[petsc-users] Forming a matrix from vectors

2020-02-17 Thread Eda Oktay
Hello all,

I am trying to form a matrix whose columns are eigenvectors I have
calculated before U = [v1,v2,v3]. Is there any easy way of forming this
matrix? My matrix should be parallel and I have created vectors as below,
where nev i s the number of requested eigenvalues. So each V[i] represents
an eigenvector and I should form a matrix by using V.

Vec *V;
  VecDuplicateVecs(vr,nev,);
  for (i=0; i

Re: [petsc-users] Bad Termination error in MatPartitioningApply with ParMETIS

2019-12-18 Thread Eda Oktay
Hi all,

I solved the problem by using different routine.

Thanks anyway!

Eda

Eda Oktay , 18 Ara 2019 Çar, 13:21 tarihinde şunu
yazdı:

> Hi all,
>
> I am trying to partition a matrix in multiple processes. However, at some
> point I get the following eror:
>
> [ 0] ***ASSERTION failed on line 176 of file
> /home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/externalpackages/git.parmetis/libparmetis/comm.c:
> j == nnbrs
> [ 2] [ 3] ***ASSERTION failed on line 176 of file
> /home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/externalpackages/git.parmetis/libparmetis/comm.c:
> j == nnbrs
> enson_unweighted_yeni_vertexweight_imbalance_without_spectral:
> /home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/externalpackages/git.parmetis/libparmetis/comm.c:176:
> libparmetis__CommSetup: Assertion `j == nnbrs' failed.
> enson_unweighted_yeni_vertexweight_imbalance_without_spectral:
> /home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/externalpackages/git.parmetis/libparmetis/comm.c:176:
> libparmetis__CommSetup: Assertion `j == nnbrs' failed.
> ***ASSERTION failed on line 176 of file
> /home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/externalpackages/git.parmetis/libparmetis/comm.c:
> j == nnbrs
> enson_unweighted_yeni_vertexweight_imbalance_without_spectral:
> /home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/externalpackages/git.parmetis/libparmetis/comm.c:176:
> libparmetis__CommSetup: Assertion `j == nnbrs' failed.
>
>
> ===
> =   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
> =   PID 13751 RUNNING AT d1e.wls.metu.edu.tr
> =   EXIT CODE: 134
> =   CLEANING UP REMAINING PROCESSES
> =   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
>
> ===
> YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Aborted (signal 6)
> This typically refers to a problem with your application.
> Please see the FAQ page for debugging suggestions
>
> I get the error for example in 9*9 matrix for 4 processes. Why a I getting
> this message, it is working with 2 processes for all matrices but when I
> increase process number, it starts to give this message at some point.
>
> Thanks!
>
> Eda
>


Re: [petsc-users] Noncomforming object sizes error in MatEqual

2019-12-18 Thread Eda Oktay
Hi all,

I solved the problem by using different routine.

Thanks anyway!

Eda

Eda Oktay , 18 Ara 2019 Çar, 10:24 tarihinde şunu
yazdı:

> Hello everyone,
>
> In a part of my code, I am trying to understand whether a matrix is equal
> to its transpose, that is why I am using MatEqual(). However, for most of
> the matrices I took from University of Florida State Sparse Matrix Library,
> I get the following error for more than 2 processes, where main() line 155
> is MatEqual:
>
> [2]PETSC ERROR: - Error Message
> --
> [2]PETSC ERROR: Nonconforming object sizes
> [2]PETSC ERROR: Mat A,Mat B: global dim 6 6 8 5
> [2]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
> [2]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019
> [2]PETSC ERROR: ./yeni_vertexweight_imbalance_without_spectral on a
> arch-linux2-c-debug named d1e.wls.metu.edu.tr by edaoktay Wed Dec 18
> 10:18:30 2019
> [2]PETSC ERROR: Configure options --download-mpich --download-openblas
> --download-slepc --download-metis --download-parmetis --download-chaco
> --with-X=1
> [2]PETSC ERROR: #1 MatEqual() line 5130 in
> /home/edaoktay/petsc-3.11.1/src/mat/interface/matrix.c
> [2]PETSC ERROR: #2 MatEqual_MPIAIJ() line 2112 in
> /home/edaoktay/petsc-3.11.1/src/mat/impls/aij/mpi/mpiaij.c
> [2]PETSC ERROR: #3 MatEqual() line 5136 in
> /home/edaoktay/petsc-3.11.1/src/mat/interface/matrix.c
> [2]PETSC ERROR: #4 main() line 115 in
> /home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/share/slepc/examples/src/eda/yeni_vertexweight_imbalance_without_spectral.c
> [2]PETSC ERROR: PETSc Option Table entries:
> [2]PETSC ERROR: -f
> /home/edaoktay/petsc-3.11.1/share/petsc/datafiles/matrices/binary_files/Ragusa16_binary
> [2]PETSC ERROR: -mat_partitioning_type parmetis
> [2]PETSC ERROR: End of Error Message ---send entire
> error message to petsc-ma...@mcs.anl.gov--
>
> And this is the part of my code:
>
>   ierr = PetscInitialize(,,(char*)0,help);if (ierr) return ierr;
>
>   /*
>  Determine files from which we read matrix
>   */
>
>   ierr =
> PetscOptionsGetString(NULL,NULL,"-f",file,PETSC_MAX_PATH_LEN,);CHKERRQ(ierr);
>   if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must indicate binary file with the
> -f option");
>
>   /*
>  Open binary file.  Note that we use FILE_MODE_READ to indicate
>  reading from this file.
>   */
>
>   ierr =
> PetscViewerBinaryOpen(PETSC_COMM_WORLD,file,FILE_MODE_READ,);CHKERRQ(ierr);
>
>   /*
> Load the matrix; then destroy the viewer.
>   */
>
>   ierr = MatCreate(PETSC_COMM_WORLD,);CHKERRQ(ierr);
>
>   ierr = MatSetOptionsPrefix(A,"a_");CHKERRQ(ierr);
>   ierr = MatSetFromOptions(A);CHKERRQ(ierr);
>   ierr = MatLoad(A,fd);CHKERRQ(ierr);
>   ierr = PetscViewerDestroy();CHKERRQ(ierr);
>
>  /* PetscLogDouble v1,v2,elapsed_time;
>
>   PetscTime();   */
>
> /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> Create Partitioning
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
>
>   ierr = MatConvert(A,MATMPIADJ,MAT_INITIAL_MATRIX,);CHKERRQ(ierr);
>
>
>   ierr = MatPartitioningCreate(MPI_COMM_WORLD,);CHKERRQ(ierr);
>   ierr = MatPartitioningSetAdjacency(part,AL);CHKERRQ(ierr);
>
>   /* Symmetry check */
>
>   Mat Atr,SymmA,Atrabs,Aabs;
>   PetscBool isEqual;
>   Vec D;
>   PetscInt i;
>
> ierr = MatTranspose(A,MAT_INITIAL_MATRIX,);CHKERRQ(ierr);
> ierr = MatDuplicate(Atr,MAT_COPY_VALUES,);CHKERRQ(ierr);
> flg = PETSC_TRUE;
>
> PetscOptionsGetBool(NULL,NULL, "-check_symmetry", ,NULL);
> if (flg) {
> ierr = MatEqual(A,Atr,);CHKERRQ(ierr);
>
> For this specific error, the matrix is of size 24*24. When I checked, I
> couldn't understand what is wrong when it comes to 3rd process. I will be
> glad if someone can tell me what is wrong with my code that I get this
> dimension error.
>
> Thanks,
>
> Eda
>


[petsc-users] Bad Termination error in MatPartitioningApply with ParMETIS

2019-12-18 Thread Eda Oktay
Hi all,

I am trying to partition a matrix in multiple processes. However, at some
point I get the following eror:

[ 0] ***ASSERTION failed on line 176 of file
/home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/externalpackages/git.parmetis/libparmetis/comm.c:
j == nnbrs
[ 2] [ 3] ***ASSERTION failed on line 176 of file
/home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/externalpackages/git.parmetis/libparmetis/comm.c:
j == nnbrs
enson_unweighted_yeni_vertexweight_imbalance_without_spectral:
/home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/externalpackages/git.parmetis/libparmetis/comm.c:176:
libparmetis__CommSetup: Assertion `j == nnbrs' failed.
enson_unweighted_yeni_vertexweight_imbalance_without_spectral:
/home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/externalpackages/git.parmetis/libparmetis/comm.c:176:
libparmetis__CommSetup: Assertion `j == nnbrs' failed.
***ASSERTION failed on line 176 of file
/home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/externalpackages/git.parmetis/libparmetis/comm.c:
j == nnbrs
enson_unweighted_yeni_vertexweight_imbalance_without_spectral:
/home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/externalpackages/git.parmetis/libparmetis/comm.c:176:
libparmetis__CommSetup: Assertion `j == nnbrs' failed.

===
=   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
=   PID 13751 RUNNING AT d1e.wls.metu.edu.tr
=   EXIT CODE: 134
=   CLEANING UP REMAINING PROCESSES
=   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
===
YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Aborted (signal 6)
This typically refers to a problem with your application.
Please see the FAQ page for debugging suggestions

I get the error for example in 9*9 matrix for 4 processes. Why a I getting
this message, it is working with 2 processes for all matrices but when I
increase process number, it starts to give this message at some point.

Thanks!

Eda


[petsc-users] Noncomforming object sizes error in MatEqual

2019-12-17 Thread Eda Oktay
Hello everyone,

In a part of my code, I am trying to understand whether a matrix is equal
to its transpose, that is why I am using MatEqual(). However, for most of
the matrices I took from University of Florida State Sparse Matrix Library,
I get the following error for more than 2 processes, where main() line 155
is MatEqual:

[2]PETSC ERROR: - Error Message
--
[2]PETSC ERROR: Nonconforming object sizes
[2]PETSC ERROR: Mat A,Mat B: global dim 6 6 8 5
[2]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for
trouble shooting.
[2]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019
[2]PETSC ERROR: ./yeni_vertexweight_imbalance_without_spectral on a
arch-linux2-c-debug named d1e.wls.metu.edu.tr by edaoktay Wed Dec 18
10:18:30 2019
[2]PETSC ERROR: Configure options --download-mpich --download-openblas
--download-slepc --download-metis --download-parmetis --download-chaco
--with-X=1
[2]PETSC ERROR: #1 MatEqual() line 5130 in
/home/edaoktay/petsc-3.11.1/src/mat/interface/matrix.c
[2]PETSC ERROR: #2 MatEqual_MPIAIJ() line 2112 in
/home/edaoktay/petsc-3.11.1/src/mat/impls/aij/mpi/mpiaij.c
[2]PETSC ERROR: #3 MatEqual() line 5136 in
/home/edaoktay/petsc-3.11.1/src/mat/interface/matrix.c
[2]PETSC ERROR: #4 main() line 115 in
/home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/share/slepc/examples/src/eda/yeni_vertexweight_imbalance_without_spectral.c
[2]PETSC ERROR: PETSc Option Table entries:
[2]PETSC ERROR: -f
/home/edaoktay/petsc-3.11.1/share/petsc/datafiles/matrices/binary_files/Ragusa16_binary
[2]PETSC ERROR: -mat_partitioning_type parmetis
[2]PETSC ERROR: End of Error Message ---send entire
error message to petsc-ma...@mcs.anl.gov--

And this is the part of my code:

  ierr = PetscInitialize(,,(char*)0,help);if (ierr) return ierr;

  /*
 Determine files from which we read matrix
  */

  ierr =
PetscOptionsGetString(NULL,NULL,"-f",file,PETSC_MAX_PATH_LEN,);CHKERRQ(ierr);
  if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must indicate binary file with the
-f option");

  /*
 Open binary file.  Note that we use FILE_MODE_READ to indicate
 reading from this file.
  */

  ierr =
PetscViewerBinaryOpen(PETSC_COMM_WORLD,file,FILE_MODE_READ,);CHKERRQ(ierr);

  /*
Load the matrix; then destroy the viewer.
  */

  ierr = MatCreate(PETSC_COMM_WORLD,);CHKERRQ(ierr);

  ierr = MatSetOptionsPrefix(A,"a_");CHKERRQ(ierr);
  ierr = MatSetFromOptions(A);CHKERRQ(ierr);
  ierr = MatLoad(A,fd);CHKERRQ(ierr);
  ierr = PetscViewerDestroy();CHKERRQ(ierr);

 /* PetscLogDouble v1,v2,elapsed_time;

  PetscTime();   */

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Create Partitioning
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

  ierr = MatConvert(A,MATMPIADJ,MAT_INITIAL_MATRIX,);CHKERRQ(ierr);


  ierr = MatPartitioningCreate(MPI_COMM_WORLD,);CHKERRQ(ierr);
  ierr = MatPartitioningSetAdjacency(part,AL);CHKERRQ(ierr);

  /* Symmetry check */

  Mat Atr,SymmA,Atrabs,Aabs;
  PetscBool isEqual;
  Vec D;
  PetscInt i;

ierr = MatTranspose(A,MAT_INITIAL_MATRIX,);CHKERRQ(ierr);
ierr = MatDuplicate(Atr,MAT_COPY_VALUES,);CHKERRQ(ierr);
flg = PETSC_TRUE;

PetscOptionsGetBool(NULL,NULL, "-check_symmetry", ,NULL);
if (flg) {
ierr = MatEqual(A,Atr,);CHKERRQ(ierr);

For this specific error, the matrix is of size 24*24. When I checked, I
couldn't understand what is wrong when it comes to 3rd process. I will be
glad if someone can tell me what is wrong with my code that I get this
dimension error.

Thanks,

Eda


[petsc-users] Edge-cut information for CHACO

2019-12-05 Thread Eda Oktay
Hello all,

I am trying to find edge cut information of ParMETIS and CHACO. When I use
ParMETIS,
MatPartitioningViewImbalance(part,partitioning)
works and it gives also number of cuts.

However, when I used CHACO, it only gives imbalance information, not edge
cut. I have index sets but I couldn't find how to calculate edge cut.

Also, does ParMETIS calculate edge cuts according to the values of weights
or number of weights?

Thanks!

Eda


[petsc-users] Drawing partitioned graphs via PETSc

2019-12-04 Thread Eda Oktay
Hello all,

I am partitioning some graphs and I need to visualize them. I was wondering
if I can do it in PETSc. I know that there is some Draw routines but most
of them are for line graphs. ı didn't use PETSc for drawing before so I
don't know how and what to do.

Thanks!

Eda


Re: [petsc-users] Index set in Chaco

2019-07-30 Thread Eda Oktay via petsc-users
Yes I use -mat_partitioning chaco.


[petsc-users] Index set in Chaco

2019-07-29 Thread Eda Oktay via petsc-users
Hello everyone,

I am trying to partition a matrix by using chaco. By using ex15 from mat
examples, I wrote the code below:

MatPartitioningCreate(MPI_COMM_WORLD, );
MatPartitioningSetAdjacency(part, A);
MatPartitioningSetFromOptions(part);
MatPartitioningApply(part, );
ISView(is, PETSC_VIEWER_STDOUT_WORLD);
ISDestroy();
MatPartitioningDestroy();
MatDestroy();

However, I always get zeros when I printed index set. I tried to change
eigensolver but it doesn't work. Since this is the first time I am using
Chaco, I couldn't understand where I did something wrong.

Thanks,

Eda


Re: [petsc-users] Imbalance in ParMETIS

2019-07-19 Thread Eda Oktay via petsc-users
Dear Matt,

You were right, I confused concepts. By setting vertex weights, I am able
to get different number of edge cuts.

Thanks,

Eda

Matthew Knepley , 1 Tem 2019 Pzt, 13:10 tarihinde şunu
yazdı:

> On Mon, Jul 1, 2019 at 3:00 AM Eda Oktay  wrote:
>
>> Dear Matt,
>>
>> In order to get a nice cut, I am trying to change the balance, that is
>> why I tried to change ubvec. But still I couldn't understand why it didn't
>> change anything.
>>
>> I tried to change vertex weights but it only made Max and Min change but
>> it didn't change the cut.
>>
>
> I think you are confusing concepts. The "cut" is the number of edges
> discarded when you divide the mesh
> into pieces, but each piece is supposed to have an equal size. The only
> way you can get the partitioner to
> divide the mesh into pieces of unequal size is to use vertex weights.
>
>   Thanks,
>
>  Matt
>
>
>> Thanks,
>>
>> Eda
>>
>>
>> On Fri, Jun 28, 2019, 1:49 PM Matthew Knepley  wrote:
>>
>>> On Fri, Jun 28, 2019 at 5:38 AM Eda Oktay via petsc-users <
>>> petsc-users@mcs.anl.gov> wrote:
>>>
>>>> Hello everyone,
>>>>
>>>> I am trying to change load balance in ParMETIS in order to give
>>>> different number of elements to different processors. In the manual, it
>>>> states that changing "ubvec" parameter should work. So, instead of 1.05, I
>>>> gave 1.2,1.5 and so on but load balance didn't change. I always get Max 5
>>>> Min 5 when I view load balance. The partitioning part of my code is:
>>>>
>>>
>>> ParMetis is always balancing. ubvec changes the balance between having
>>> even partitions and a nice cut. If
>>> you want unbalanced partitions, you have to change the vertex weights.
>>>
>>>   Thanks,
>>>
>>> Matt
>>>
>>>
>>>>  ierr = MatConvert(A,MATMPIADJ,MAT_INITIAL_MATRIX,);CHKERRQ(ierr);
>>>>
>>>>   ierr = MatPartitioningCreate(MPI_COMM_WORLD,);CHKERRQ(ierr);
>>>>   ierr = MatPartitioningSetAdjacency(part,AL);CHKERRQ(ierr);
>>>>
>>>>   ierr = MatPartitioningSetFromOptions(part);CHKERRQ(ierr);
>>>>   ierr = MatPartitioningApply(part,);CHKERRQ(ierr);
>>>>   MatPartitioningViewImbalance(part,partitioning);
>>>>
>>>> What should I do? Why changing ubvec didn't change anything, am I
>>>> missing something?
>>>>
>>>> Thanks,
>>>>
>>>> Eda
>>>>
>>>
>>>
>>> --
>>> 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
>>>
>>> https://www.cse.buffalo.edu/~knepley/
>>> <http://www.cse.buffalo.edu/~knepley/>
>>>
>>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>


Re: [petsc-users] Imbalance in ParMETIS

2019-07-01 Thread Eda Oktay via petsc-users
Dear Matt,

In order to get a nice cut, I am trying to change the balance, that is why
I tried to change ubvec. But still I couldn't understand why it didn't
change anything.

I tried to change vertex weights but it only made Max and Min change but it
didn't change the cut.

Thanks,

Eda


On Fri, Jun 28, 2019, 1:49 PM Matthew Knepley  wrote:

> On Fri, Jun 28, 2019 at 5:38 AM Eda Oktay via petsc-users <
> petsc-users@mcs.anl.gov> wrote:
>
>> Hello everyone,
>>
>> I am trying to change load balance in ParMETIS in order to give different
>> number of elements to different processors. In the manual, it states that
>> changing "ubvec" parameter should work. So, instead of 1.05, I gave 1.2,1.5
>> and so on but load balance didn't change. I always get Max 5 Min 5 when I
>> view load balance. The partitioning part of my code is:
>>
>
> ParMetis is always balancing. ubvec changes the balance between having
> even partitions and a nice cut. If
> you want unbalanced partitions, you have to change the vertex weights.
>
>   Thanks,
>
> Matt
>
>
>>  ierr = MatConvert(A,MATMPIADJ,MAT_INITIAL_MATRIX,);CHKERRQ(ierr);
>>
>>   ierr = MatPartitioningCreate(MPI_COMM_WORLD,);CHKERRQ(ierr);
>>   ierr = MatPartitioningSetAdjacency(part,AL);CHKERRQ(ierr);
>>
>>   ierr = MatPartitioningSetFromOptions(part);CHKERRQ(ierr);
>>   ierr = MatPartitioningApply(part,);CHKERRQ(ierr);
>>   MatPartitioningViewImbalance(part,partitioning);
>>
>> What should I do? Why changing ubvec didn't change anything, am I
>> missing something?
>>
>> Thanks,
>>
>> Eda
>>
>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>


[petsc-users] Imbalance in ParMETIS

2019-06-28 Thread Eda Oktay via petsc-users
Hello everyone,

I am trying to change load balance in ParMETIS in order to give different
number of elements to different processors. In the manual, it states that
changing "ubvec" parameter should work. So, instead of 1.05, I gave 1.2,1.5
and so on but load balance didn't change. I always get Max 5 Min 5 when I
view load balance. The partitioning part of my code is:

 ierr = MatConvert(A,MATMPIADJ,MAT_INITIAL_MATRIX,);CHKERRQ(ierr);

  ierr = MatPartitioningCreate(MPI_COMM_WORLD,);CHKERRQ(ierr);
  ierr = MatPartitioningSetAdjacency(part,AL);CHKERRQ(ierr);

  ierr = MatPartitioningSetFromOptions(part);CHKERRQ(ierr);
  ierr = MatPartitioningApply(part,);CHKERRQ(ierr);
  MatPartitioningViewImbalance(part,partitioning);

What should I do? Why changing ubvec didn't change anything, am I
missing something?

Thanks,

Eda


[petsc-users] ParMETIS Load Imbalance

2019-06-20 Thread Eda Oktay via petsc-users
Hello everyone,

I am trying to partition a matrix into unequal parts: for example I am
trying to partition a 10*10 matrix into 4*4 and 6*6 submatrices. However,
ParMETIS is always dividing the matrix into 2 equal parts (5*5).

The reason why I am trying to do this is that I am using spectral
partitioning method.First, I find the eigenvector corresponding to second
smallest eigenvalue and then sort the vector according to signs of
elements. So, if there is 4 negative values in the vector, the matrix
should be divided as 4*4 and 6*6. But I can't do it by using ParMETIS.

I tried MatPartitioningSetPartitionWeights but it doesn't work since it
only shows when I looked at view imbalance option that partitioning
imbalance info: max 6 min 4 but still the matrix was divided into 5*5 and
5*5.

How can I change the load balance?

Thanks,

Eda


Re: [petsc-users] Finding off diagonal blocks of matrix

2019-06-20 Thread Eda Oktay via petsc-users
Dear all,

I solved my problem without using any Petsc routine. Thanks anyway!

Eda

Smith, Barry F. , 17 Haz 2019 Pzt, 18:36 tarihinde şunu
yazdı:

>
>   If you are using a MPIAIJ matrix that has already been created you can
> use MatMPIAIJGetSeqAIJ(). This gives you back on each process the
> "diagonal" block and the "off-diagonal" block.
>
>
>
> > On Jun 17, 2019, at 7:44 AM, Eda Oktay via petsc-users <
> petsc-users@mcs.anl.gov> wrote:
> >
> > Hello everyone,
> >
> > I am trying to find the off diagonal blocks of a matrix. For example, I
> partitioned a 10*10 matrix into 4*4 and 6*6 block sub matrices. I need to
> find the other blocks in order to find the number of nonzero elements in
> them.
> >
> > I tried to use MatGetLocalSubMatrix but I couldn't figure out how to
> give iscol and isrow. Also, from the manual, ı understood that
> MatSetLocalToGlobalMapping should be used before this routine but I
> couldn't used it properly because before MatGetLocalSuMatrix, the submatrix
> doesn't exist. I tried to give zero to all elements so that I can use
> Mapping routine, but I got an error saying that it is invalid.
> >
> > How can I fix this probelm?
> >
> > Thank you,
> >
> > Eda
>
>


Re: [petsc-users] MatPermute problem because of wrong sized index set

2019-06-17 Thread Eda Oktay via petsc-users
 I did but ı didn't send you that part:

PetscInt kk;

  for (i=0;i, 17 Haz 2019 Pzt, 16:23 tarihinde şunu yazdı:

> You also do not seem to be initializing kk.
>
> On Mon, Jun 17, 2019 at 4:00 AM Eda Oktay via petsc-users <
> petsc-users@mcs.anl.gov> wrote:
>
>> Hello everyone again,
>>
>> I was making an index mistake in for loop. I corrected it and my problem
>> solved.
>>
>> Thank you,
>>
>> Eda
>>
>> Eda Oktay , 17 Haz 2019 Pzt, 10:28 tarihinde şunu
>> yazdı:
>>
>>> Hello everyone,
>>>
>>> I am trying to permute a matrix by using a sorted eigenvector in order
>>> to partition the matrix. I sorted the vector and got the index set idx. I
>>> am using 2 processors and I have to divide the vector into 2 according to
>>> the sign of elements (first negative signed ones, then positive signed
>>> ones) first, so I wrote the code below (if-else part). After sorting and
>>> dividing them, I need to permute the matrix with these index sets.
>>>
>>> However, in last line (MatPermute), I got the following error:
>>>
>>> [0]PETSC ERROR: - Error Message
>>> --
>>> [0]PETSC ERROR: Argument out of range
>>> [0]PETSC ERROR: Index 13 is out of range
>>> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
>>> for trouble shooting.
>>> [0]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019
>>> [0]PETSC ERROR: ./son_without_parmetis on a arch-linux2-c-debug named
>>> 5470.wls.metu.edu.tr by edaoktay Mon Jun 17 10:11:54 2019
>>> [0]PETSC ERROR: Configure options --download-mpich --download-openblas
>>> --download-slepc --download-metis --download-parmetis --download-chaco
>>> --with-X=1
>>> [0]PETSC ERROR: #1 PetscLayoutFindOwner() line 249 in
>>> /home/edaoktay/petsc-3.11.1/include/petscis.h
>>> [0]PETSC ERROR: #2 PetscSFSetGraphLayout() line 545 in
>>> /home/edaoktay/petsc-3.11.1/src/vec/is/utils/pmap.c
>>> [0]PETSC ERROR: #3 MatPermute_MPIAIJ() line 1622 in
>>> /home/edaoktay/petsc-3.11.1/src/mat/impls/aij/mpi/mpiaij.c
>>> [0]PETSC ERROR: #4 MatPermute() line 5095 in
>>> /home/edaoktay/petsc-3.11.1/src/mat/interface/matrix.c
>>> [0]PETSC ERROR: #5 main() line 354 in
>>> /home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/share/slepc/examples/src/eda/son_without_parmetis.c
>>> [0]PETSC ERROR: PETSc Option Table entries:
>>> [0]PETSC ERROR: -f
>>> /home/edaoktay/petsc-3.11.1/share/petsc/datafiles/matrices/binary_files/LFAT5_binary
>>> [0]PETSC ERROR: -weighted
>>> [0]PETSC ERROR: End of Error Message ---send entire
>>> error message to petsc-ma...@mcs.anl.gov--
>>>
>>> I also found out that when I look at the submatrix Ais, I got different
>>> sized matrix. For example, I used 14*14 matrix, I get the vector of length
>>> 14 but then idx is divided into 5 and 7 elements so Ais is of size 12. 2 of
>>> the positive signed elements are not counted and I didn't understand why.
>>>
>>> I also checked the if-else part and I found out that this portion of the
>>> code is ran by processor 0.  Can be this the problem for different sized
>>> Ais? And how can I fix that problem?
>>>
>>> Thanks,
>>>
>>> Eda
>>>
>>>
>>> PetscMPIInt rank,size;
>>>   MPI_Comm_rank(PETSC_COMM_WORLD, );
>>>   MPI_Comm_size(PETSC_COMM_WORLD, );
>>>
>>>   PetscInt kk;
>>>
>>>   for (i=0;i>>   if (avr[i] < 0){
>>>   ++kk;
>>>   }
>>>   }
>>>
>>>   PetscInt *idxx;
>>>   IS iskk;
>>>   PetscInt sizeofidxx;
>>>   if (rank == 0){
>>>
>>>   PetscMalloc1(kk,);
>>>   j = 0;
>>>   for (i=0; i>>   idxx[j] = idx[i];
>>>   j++;
>>>   }
>>>   } else{
>>>   PetscMalloc1(siz-kk,);
>>>   j = 0;
>>>   for (i=siz-kk-2 ;i>>   idxx[j] = idx[i];
>>>   j++;
>>>   }
>>>   }
>>>
>>>   sizeofidxx = j;
>>>
>>> ISCreateGeneral(PETSC_COMM_WORLD,sizeofidxx,idxx,PETSC_COPY_VALUES,);
>>>   ISView(is,PETSC_VIEWER_STDOUT_WORLD);
>>>
>>>   /*Permute matrix L (spy(A(p1,p1)))*/
>>>
>>>   Mat Ais;
>>>   MatCreateSubMatrix(A,is,is,MAT_INITIAL_MATRIX,);
>>>   ierr =ISSetPermutation(is);CHKERRQ(ierr);
>>>
>>> /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>>> -
>>> Create Partitioning
>>>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>>> */
>>> PetscInt mA,nA,mL,nL;
>>> MatGetSize(Ais,,);
>>> MatGetLocalSize(Ais,,);
>>> PetscPrintf(PETSC_COMM_WORLD," Size of Ais: %D,%D\n",mA,nA);
>>> PetscPrintf(PETSC_COMM_WORLD," Size of local Ais: %D,%D\n",mL,nL);
>>>
>>>   ierr = MatPermute(Ais,is,is,);CHKERRQ(ierr);
>>>
>>


[petsc-users] Finding off diagonal blocks of matrix

2019-06-17 Thread Eda Oktay via petsc-users
Hello everyone,

I am trying to find the off diagonal blocks of a matrix. For example, I
partitioned a 10*10 matrix into 4*4 and 6*6 block sub matrices. I need to
find the other blocks in order to find the number of nonzero elements in
them.

I tried to use MatGetLocalSubMatrix but I couldn't figure out how to give
iscol and isrow. Also, from the manual, ı understood that
MatSetLocalToGlobalMapping should be used before this routine but I
couldn't used it properly because before MatGetLocalSuMatrix, the submatrix
doesn't exist. I tried to give zero to all elements so that I can use
Mapping routine, but I got an error saying that it is invalid.

How can I fix this probelm?

Thank you,

Eda


Re: [petsc-users] MatPermute problem because of wrong sized index set

2019-06-17 Thread Eda Oktay via petsc-users
Hello everyone again,

I was making an index mistake in for loop. I corrected it and my problem
solved.

Thank you,

Eda

Eda Oktay , 17 Haz 2019 Pzt, 10:28 tarihinde şunu
yazdı:

> Hello everyone,
>
> I am trying to permute a matrix by using a sorted eigenvector in order to
> partition the matrix. I sorted the vector and got the index set idx. I am
> using 2 processors and I have to divide the vector into 2 according to the
> sign of elements (first negative signed ones, then positive signed ones)
> first, so I wrote the code below (if-else part). After sorting and dividing
> them, I need to permute the matrix with these index sets.
>
> However, in last line (MatPermute), I got the following error:
>
> [0]PETSC ERROR: - Error Message
> --
> [0]PETSC ERROR: Argument out of range
> [0]PETSC ERROR: Index 13 is out of range
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
> [0]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019
> [0]PETSC ERROR: ./son_without_parmetis on a arch-linux2-c-debug named
> 5470.wls.metu.edu.tr by edaoktay Mon Jun 17 10:11:54 2019
> [0]PETSC ERROR: Configure options --download-mpich --download-openblas
> --download-slepc --download-metis --download-parmetis --download-chaco
> --with-X=1
> [0]PETSC ERROR: #1 PetscLayoutFindOwner() line 249 in
> /home/edaoktay/petsc-3.11.1/include/petscis.h
> [0]PETSC ERROR: #2 PetscSFSetGraphLayout() line 545 in
> /home/edaoktay/petsc-3.11.1/src/vec/is/utils/pmap.c
> [0]PETSC ERROR: #3 MatPermute_MPIAIJ() line 1622 in
> /home/edaoktay/petsc-3.11.1/src/mat/impls/aij/mpi/mpiaij.c
> [0]PETSC ERROR: #4 MatPermute() line 5095 in
> /home/edaoktay/petsc-3.11.1/src/mat/interface/matrix.c
> [0]PETSC ERROR: #5 main() line 354 in
> /home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/share/slepc/examples/src/eda/son_without_parmetis.c
> [0]PETSC ERROR: PETSc Option Table entries:
> [0]PETSC ERROR: -f
> /home/edaoktay/petsc-3.11.1/share/petsc/datafiles/matrices/binary_files/LFAT5_binary
> [0]PETSC ERROR: -weighted
> [0]PETSC ERROR: End of Error Message ---send entire
> error message to petsc-ma...@mcs.anl.gov--
>
> I also found out that when I look at the submatrix Ais, I got different
> sized matrix. For example, I used 14*14 matrix, I get the vector of length
> 14 but then idx is divided into 5 and 7 elements so Ais is of size 12. 2 of
> the positive signed elements are not counted and I didn't understand why.
>
> I also checked the if-else part and I found out that this portion of the
> code is ran by processor 0.  Can be this the problem for different sized
> Ais? And how can I fix that problem?
>
> Thanks,
>
> Eda
>
>
> PetscMPIInt rank,size;
>   MPI_Comm_rank(PETSC_COMM_WORLD, );
>   MPI_Comm_size(PETSC_COMM_WORLD, );
>
>   PetscInt kk;
>
>   for (i=0;i   if (avr[i] < 0){
>   ++kk;
>   }
>   }
>
>   PetscInt *idxx;
>   IS iskk;
>   PetscInt sizeofidxx;
>   if (rank == 0){
>
>   PetscMalloc1(kk,);
>   j = 0;
>   for (i=0; i   idxx[j] = idx[i];
>   j++;
>   }
>   } else{
>   PetscMalloc1(siz-kk,);
>   j = 0;
>   for (i=siz-kk-2 ;i   idxx[j] = idx[i];
>   j++;
>   }
>   }
>
>   sizeofidxx = j;
>   ISCreateGeneral(PETSC_COMM_WORLD,sizeofidxx,idxx,PETSC_COPY_VALUES,);
>   ISView(is,PETSC_VIEWER_STDOUT_WORLD);
>
>   /*Permute matrix L (spy(A(p1,p1)))*/
>
>   Mat Ais;
>   MatCreateSubMatrix(A,is,is,MAT_INITIAL_MATRIX,);
>   ierr =ISSetPermutation(is);CHKERRQ(ierr);
>
> /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> Create Partitioning
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
> PetscInt mA,nA,mL,nL;
> MatGetSize(Ais,,);
> MatGetLocalSize(Ais,,);
> PetscPrintf(PETSC_COMM_WORLD," Size of Ais: %D,%D\n",mA,nA);
> PetscPrintf(PETSC_COMM_WORLD," Size of local Ais: %D,%D\n",mL,nL);
>
>   ierr = MatPermute(Ais,is,is,);CHKERRQ(ierr);
>


[petsc-users] MatPermute problem because of wrong sized index set

2019-06-17 Thread Eda Oktay via petsc-users
Hello everyone,

I am trying to permute a matrix by using a sorted eigenvector in order to
partition the matrix. I sorted the vector and got the index set idx. I am
using 2 processors and I have to divide the vector into 2 according to the
sign of elements (first negative signed ones, then positive signed ones)
first, so I wrote the code below (if-else part). After sorting and dividing
them, I need to permute the matrix with these index sets.

However, in last line (MatPermute), I got the following error:

[0]PETSC ERROR: - Error Message
--
[0]PETSC ERROR: Argument out of range
[0]PETSC ERROR: Index 13 is out of range
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for
trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019
[0]PETSC ERROR: ./son_without_parmetis on a arch-linux2-c-debug named
5470.wls.metu.edu.tr by edaoktay Mon Jun 17 10:11:54 2019
[0]PETSC ERROR: Configure options --download-mpich --download-openblas
--download-slepc --download-metis --download-parmetis --download-chaco
--with-X=1
[0]PETSC ERROR: #1 PetscLayoutFindOwner() line 249 in
/home/edaoktay/petsc-3.11.1/include/petscis.h
[0]PETSC ERROR: #2 PetscSFSetGraphLayout() line 545 in
/home/edaoktay/petsc-3.11.1/src/vec/is/utils/pmap.c
[0]PETSC ERROR: #3 MatPermute_MPIAIJ() line 1622 in
/home/edaoktay/petsc-3.11.1/src/mat/impls/aij/mpi/mpiaij.c
[0]PETSC ERROR: #4 MatPermute() line 5095 in
/home/edaoktay/petsc-3.11.1/src/mat/interface/matrix.c
[0]PETSC ERROR: #5 main() line 354 in
/home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/share/slepc/examples/src/eda/son_without_parmetis.c
[0]PETSC ERROR: PETSc Option Table entries:
[0]PETSC ERROR: -f
/home/edaoktay/petsc-3.11.1/share/petsc/datafiles/matrices/binary_files/LFAT5_binary
[0]PETSC ERROR: -weighted
[0]PETSC ERROR: End of Error Message ---send entire
error message to petsc-ma...@mcs.anl.gov--

I also found out that when I look at the submatrix Ais, I got different
sized matrix. For example, I used 14*14 matrix, I get the vector of length
14 but then idx is divided into 5 and 7 elements so Ais is of size 12. 2 of
the positive signed elements are not counted and I didn't understand why.

I also checked the if-else part and I found out that this portion of the
code is ran by processor 0.  Can be this the problem for different sized
Ais? And how can I fix that problem?

Thanks,

Eda


PetscMPIInt rank,size;
  MPI_Comm_rank(PETSC_COMM_WORLD, );
  MPI_Comm_size(PETSC_COMM_WORLD, );

  PetscInt kk;

  for (i=0;i

Re: [petsc-users] Matrix Decomposition

2019-05-15 Thread Eda Oktay via petsc-users
Dear Matt,

I am trying to distribute the matrix after loading it. So I tried something
like this:

  Mat B;
  PetscInt bm,bn;
  MatSetSizes(B,kk,kk,PETSC_DETERMINE,PETSC_DETERMINE);
  MatDuplicate(A,MAT_COPY_VALUES,);
  MatGetLocalSize(B,,);

where A is the original matrix (10*10) and kk is one the local sizes of A
(kk=4 so I want to divide A into 4*4 and 6*6). However, I get error in
MatSetSizes part and when I printed bm and bn, I get 5. In other words, B
is divided equally even though I tried to divide it unequally. Am I using
MatSetSizes wrong?

Thanks,

Eda

Matthew Knepley , 15 May 2019 Çar, 14:51 tarihinde şunu
yazdı:

> On Wed, May 15, 2019 at 7:35 AM Eda Oktay via petsc-users <
> petsc-users@mcs.anl.gov> wrote:
>
>> Hello,
>>
>> I am trying to divide a matrix into unequal sized parts into different
>> processors (for example I want to divide 10*10 matrix into 4*4 and 6*6
>> submatrix in two processors). When my program reads a matrix from file, it
>> automatically divides it into equal parts and then I can't change local
>> sizes.
>>
>> How can I decompose a matrix that is read from a file?
>>
>
> MatLoad() takes a matrix argument. I believe you can use MatSetSizes()
> before loading to get the distribution you want.
>
>Matt
>
>
>> Thanks,
>>
>> Eda
>>
>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>


[petsc-users] Matrix Decomposition

2019-05-15 Thread Eda Oktay via petsc-users
Hello,

I am trying to divide a matrix into unequal sized parts into different
processors (for example I want to divide 10*10 matrix into 4*4 and 6*6
submatrix in two processors). When my program reads a matrix from file, it
automatically divides it into equal parts and then I can't change local
sizes.

How can I decompose a matrix that is read from a file?

Thanks,

Eda


Re: [petsc-users] Memory Corruption Error in MatPartitioningApply

2019-05-09 Thread Eda Oktay via petsc-users
I misread local sizes of the matrix. Without using valgrind, I was able to
fix the problem by using small sized matrix. It turned out that there is an
indexing mistake.

Thank you!

Eda

On Thu, May 9, 2019, 8:53 AM Smith, Barry F.  wrote:

>
>   Did you ever make progress on this issue?
>
> > On Apr 22, 2019, at 8:47 AM, Smith, Barry F.  wrote:
> >
> >
> >  Are you able to run under valgrind? It is a bit better than the PETSc
> malloc to find each instance of memory corruption and the sooner you find
> it the easier it is to find the bug.
> https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind
> >
> >
> >
> >> On Apr 22, 2019, at 7:31 AM, Eda Oktay via petsc-users <
> petsc-users@mcs.anl.gov> wrote:
> >>
> >> Hello,
> >>
> >> I am trying to partition an odd-numbered sized (for example 4253*4253),
> square permutation matrix by using 2 processors with ParMETIS. The
> permutation matrix is obtained by permuting the matrix by an index set "is"
> (MatPermute(A,is,is,)). I checked the index set, it gives a permutation
> and it is correct.
> >>
> >> When I look at the local size of the matrix, it is given by 2127 and
> 2127 on each processor, so in order the local sizes of matrix and index
> sets to be same, I defined the index sets' sizes as 2127 and 2127.
> >>
> >> When I do that, I get memory corruption error in MatPartiitioningApply
> function. The error is as follows:
> >>
> >> [0]PETSC ERROR: PetscMallocValidate: error detected at
> MatPartitioningApply_Parmetis_Private() line 141 in
> /home/edaoktay/petsc-3.10.3/src/mat/partition/impls/pmetis/pmetis.c
> >> [0]PETSC ERROR: Memory [id=0(8512)] at address 0x19e6870 is corrupted
> (probably write past end of array)
> >> [0]PETSC ERROR: Memory originally allocated in main() line 310 in
> /home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/TEK_SAYI_SON_YENI_DENEME_TEMIZ_ENYENI_FINAL.c
> >> [0]PETSC ERROR: - Error Message
> --
> >> [0]PETSC ERROR: Memory corruption:
> http://www.mcs.anl.gov/petsc/documentation/installation.html#valgrind
> >> [0]PETSC ERROR:
> >> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
> >> [0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
> >> [0]PETSC ERROR: ./TEK_SAYI_SON_YENI_DENEME_TEMIZ_ENYENI_FINAL on a
> arch-linux2-c-debug named 13ed.wls.metu.edu.tr by edaoktay Mon Apr 22
> 14:58:52 2019
> >> [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
> --with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
> --download-metis --download-parmetis --download-superlu_dist
> --download-slepc --download-mpich
> >> [0]PETSC ERROR: #1 PetscMallocValidate() line 146 in
> /home/edaoktay/petsc-3.10.3/src/sys/memory/mtr.c
> >> [0]PETSC ERROR: #2 MatPartitioningApply_Parmetis_Private() line 141 in
> /home/edaoktay/petsc-3.10.3/src/mat/partition/impls/pmetis/pmetis.c
> >> [0]PETSC ERROR: #3 MatPartitioningApply_Parmetis() line 215 in
> /home/edaoktay/petsc-3.10.3/src/mat/partition/impls/pmetis/pmetis.c
> >> [0]PETSC ERROR: #4 MatPartitioningApply() line 340 in
> /home/edaoktay/petsc-3.10.3/src/mat/partition/partition.c
> >> [0]PETSC ERROR: #5 main() line 374 in
> /home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/TEK_SAYI_SON_YENI_DENEME_TEMIZ_ENYENI_FINAL.c
> >> [0]PETSC ERROR: PETSc Option Table entries:
> >> [0]PETSC ERROR: -f
> /home/edaoktay/petsc-3.10.3/share/petsc/datafiles/matrices/binary_files/airfoil1_binary
> >> [0]PETSC ERROR: -mat_partitioning_type parmetis
> >> [0]PETSC ERROR: -unweighted
> >> [0]PETSC ERROR: End of Error Message ---send entire
> error message to petsc-ma...@mcs.anl.gov--
> >>
> >>
> >> The line 310 is PetscMalloc1(ss,). The part of my program is
> written as below:
> >>
> >>  if (mod != 0){
> >>  ss = (siz+1)/size;//(siz+size-mod)/size;
> >>  } else{
> >>  ss = siz/size;
> >>  }
> >>
> >> PetscMalloc1(ss,);   // LINE
> 310
> >>
> >>  if (rank != size-1) {
> >>j =0;
> >>for (i=rank*ss; i<(rank+1)*ss; i++) {
> >>  idxx[j] = idx[i];
> >>  j++;
> >>}
> >>
> >>  } else {
> >>
> >>j =0;
> >>for (i=rank*ss; i >>  idxx[j] = idx[i];
> >>  j++;
> &g

[petsc-users] SLEPc in PETSc 3.11.0

2019-04-25 Thread Eda Oktay via petsc-users
Hello everyone,

I am trying to run my program in petsc 3.11.0. It is currently working in
petsc 3.10.3.

I am using slepc in the program, so when I used 3.10.3 the slepc library is
in petsc-3.10.3/arch-linux2-c-debug. However, in 3.11.0, it is only in
petsc-3.11.0/arch-linux2-c-debug/externalpackages/git.slepc. I think that
is why, my program can not be compiled. I get the following error when I
type "make asil" to make the program asil.c:

/home/edaoktay/petsc-3.11.0/arch-linux2-c-debug/bin/mpicc -o asil.o -c
-Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas
-fstack-protector -fvisibility=hidden -g3
 
-I/home/edaoktay/petsc-3.11.0/arch-linux2-c-debug/externalpackages/git.slepc/include
-I/home/edaoktay/petsc-3.11.0/arch-linux2-c-debug/externalpackages/git.slepc/arch-linux2-c-debug/include
-I/home/edaoktay/petsc-3.11.0/include
-I/home/edaoktay/petsc-3.11.0/arch-linux2-c-debug/include`pwd`/asil.c
In file included from
/home/edaoktay/petsc-3.11.0/arch-linux2-c-debug/externalpackages/git.slepc/include/slepcsys.h:45:0,
 from
/home/edaoktay/petsc-3.11.0/arch-linux2-c-debug/externalpackages/git.slepc/include/slepcst.h:16,
 from
/home/edaoktay/petsc-3.11.0/arch-linux2-c-debug/externalpackages/git.slepc/include/slepceps.h:16,
 from /home/edaoktay/petsc-3.11.0/src/eda/asil.c:10:
/home/edaoktay/petsc-3.11.0/arch-linux2-c-debug/externalpackages/git.slepc/arch-linux2-c-debug/include/slepcconf.h:1:0:
error: unterminated #if
 #if !defined(__SLEPCCONF_H)

/home/edaoktay/petsc-3.11.0/lib/petsc/conf/rules:359: recipe for target
'asil.o' failed
make: *** [asil.o] Error 1


How can I get rid of this error? I have never get this when I used 3.10.3.

Thanks!

Eda


Re: [petsc-users] Argument out of range error in MatPermute

2019-04-24 Thread Eda Oktay via petsc-users
Dear Matt,

I solved my problem by trying with 9*9 matrix as you said. I made indexing
mistake.

Thank you for answering.

Eda

Matthew Knepley , 24 Nis 2019 Çar, 14:30 tarihinde şunu
yazdı:

> On Wed, Apr 24, 2019 at 6:35 AM Stefano Zampini via petsc-users <
> petsc-users@mcs.anl.gov> wrote:
>
>> Dump the index sets and the matrix in binary and send them
>>
>
> First, reduce your problem size to about 10.
>
>   Matt
>
>
>> Il giorno mer 24 apr 2019 alle ore 13:21 Eda Oktay 
>> ha scritto:
>>
>>> Since I am using square matrix, isn't the row local size of the matrix
>>> equal to the local size of IS? They are both 2127 and 2126.
>>>
>>> Stefano Zampini , 24 Nis 2019 Çar, 13:15
>>> tarihinde şunu yazdı:
>>>
>>>> I don't understand your code. However, I suspect we have a bug here
>>>> https://bitbucket.org/petsc/petsc/src/dba4d5898a4236b42fbe8dff209f1243d2f2582a/src/mat/impls/aij/mpi/mpiaij.c#lines-1652
>>>> The code assumes the number of leaves is A->rmap->n (the row local size
>>>> of the matrix). Shouldn't this be the local size of the IS (rowp)? Barry?
>>>>
>>>> Il giorno mer 24 apr 2019 alle ore 13:03 Eda Oktay <
>>>> eda.ok...@metu.edu.tr> ha scritto:
>>>>
>>>>> Dear Stefano,
>>>>>
>>>>> Thank you for answering. When I used MatSetSizes, I got an error since
>>>>> the matrix is read from outside, but from the error I understood that
>>>>> actually the local sizes are 2127 and 2126, so I misunderstood the 
>>>>> problem.
>>>>> I am sorry for my mistake.
>>>>>
>>>>> However, I still cannot understand where is the error. Because both
>>>>> communicators and local sizes of IS and the matrix are the same. I still
>>>>> get the same error in MatPermute:
>>>>>
>>>>> [0]PETSC ERROR: Argument out of range
>>>>> [0]PETSC ERROR: Index -1081207334 is out of range
>>>>> [0]PETSC ERROR: See
>>>>> http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble
>>>>> shooting.
>>>>> [0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
>>>>> [0]PETSC ERROR: ./TEKRAR_TEK_SAYI_SON_YENI_DENEME_TEMIZ_ENYENI_FINAL
>>>>> on a arch-linux2-c-debug named 53d.wls.metu.edu.tr by edaoktay Wed
>>>>> Apr 24 11:22:15 2019
>>>>> [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
>>>>> --with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
>>>>> --download-metis --download-parmetis --download-superlu_dist
>>>>> --download-slepc --download-mpich
>>>>> [0]PETSC ERROR: #1 PetscLayoutFindOwner() line 248 in
>>>>> /home/edaoktay/petsc-3.10.3/include/petscis.h
>>>>> [0]PETSC ERROR: #2 MatPermute_MPIAIJ() line 1685 in
>>>>> /home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
>>>>> [0]PETSC ERROR: #3 MatPermute() line 4997 in
>>>>> /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
>>>>> [0]PETSC ERROR: #4 main() line 361 in
>>>>> /home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/TEKRAR_TEK_SAYI_SON_YENI_DENEME_TEMIZ_ENYENI_FINAL.c
>>>>>
>>>>> This is the part of my program:
>>>>>
>>>>>   ierr = MatCreateVecs(L,,NULL);CHKERRQ(ierr);
>>>>>   ierr = EPSGetEigenpair(eps,0,,NULL,vr,NULL);
>>>>>   ierr = PetscPrintf(PETSC_COMM_WORLD," The second smallest
>>>>> eigenvalue: %g\n",kr);CHKERRQ(ierr);
>>>>>
>>>>>   /* sort second smallest eigenvector */
>>>>>
>>>>>   ierr = VecGetSize(vr,);CHKERRQ(ierr);
>>>>>   ierr = PetscMalloc1(siz,);CHKERRQ(ierr);
>>>>>   for (i=0; i>>>>
>>>>>   VecScatter ctx;
>>>>>   Vec vout;
>>>>>   VecScatterCreateToAll(vr,,);
>>>>>   VecScatterBegin(ctx,vr,vout,INSERT_VALUES,SCATTER_FORWARD);
>>>>>   VecScatterEnd(ctx,vr,vout,INSERT_VALUES,SCATTER_FORWARD);
>>>>>   VecScatterDestroy();
>>>>>
>>>>>   PetscScalar *avr;
>>>>>   ierr = VecGetArray(vout,);CHKERRQ(ierr);
>>>>>   ierr = PetscSortRealWithPermutation(siz,avr,idx);CHKERRQ(ierr);
>>>>>
>>>>>   /*Select out a piece of the resulting indices idx on each process;
>>>>> for example w

Re: [petsc-users] Argument out of range error in MatPermute

2019-04-24 Thread Eda Oktay via petsc-users
Since I am using square matrix, isn't the row local size of the matrix
equal to the local size of IS? They are both 2127 and 2126.

Stefano Zampini , 24 Nis 2019 Çar, 13:15
tarihinde şunu yazdı:

> I don't understand your code. However, I suspect we have a bug here
> https://bitbucket.org/petsc/petsc/src/dba4d5898a4236b42fbe8dff209f1243d2f2582a/src/mat/impls/aij/mpi/mpiaij.c#lines-1652
> The code assumes the number of leaves is A->rmap->n (the row local size of
> the matrix). Shouldn't this be the local size of the IS (rowp)? Barry?
>
> Il giorno mer 24 apr 2019 alle ore 13:03 Eda Oktay 
> ha scritto:
>
>> Dear Stefano,
>>
>> Thank you for answering. When I used MatSetSizes, I got an error since
>> the matrix is read from outside, but from the error I understood that
>> actually the local sizes are 2127 and 2126, so I misunderstood the problem.
>> I am sorry for my mistake.
>>
>> However, I still cannot understand where is the error. Because both
>> communicators and local sizes of IS and the matrix are the same. I still
>> get the same error in MatPermute:
>>
>> [0]PETSC ERROR: Argument out of range
>> [0]PETSC ERROR: Index -1081207334 is out of range
>> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
>> for trouble shooting.
>> [0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
>> [0]PETSC ERROR: ./TEKRAR_TEK_SAYI_SON_YENI_DENEME_TEMIZ_ENYENI_FINAL on a
>> arch-linux2-c-debug named 53d.wls.metu.edu.tr by edaoktay Wed Apr 24
>> 11:22:15 2019
>> [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
>> --with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
>> --download-metis --download-parmetis --download-superlu_dist
>> --download-slepc --download-mpich
>> [0]PETSC ERROR: #1 PetscLayoutFindOwner() line 248 in
>> /home/edaoktay/petsc-3.10.3/include/petscis.h
>> [0]PETSC ERROR: #2 MatPermute_MPIAIJ() line 1685 in
>> /home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
>> [0]PETSC ERROR: #3 MatPermute() line 4997 in
>> /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
>> [0]PETSC ERROR: #4 main() line 361 in
>> /home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/TEKRAR_TEK_SAYI_SON_YENI_DENEME_TEMIZ_ENYENI_FINAL.c
>>
>> This is the part of my program:
>>
>>   ierr = MatCreateVecs(L,,NULL);CHKERRQ(ierr);
>>   ierr = EPSGetEigenpair(eps,0,,NULL,vr,NULL);
>>   ierr = PetscPrintf(PETSC_COMM_WORLD," The second smallest eigenvalue:
>> %g\n",kr);CHKERRQ(ierr);
>>
>>   /* sort second smallest eigenvector */
>>
>>   ierr = VecGetSize(vr,);CHKERRQ(ierr);
>>   ierr = PetscMalloc1(siz,);CHKERRQ(ierr);
>>   for (i=0; i>
>>   VecScatter ctx;
>>   Vec vout;
>>   VecScatterCreateToAll(vr,,);
>>   VecScatterBegin(ctx,vr,vout,INSERT_VALUES,SCATTER_FORWARD);
>>   VecScatterEnd(ctx,vr,vout,INSERT_VALUES,SCATTER_FORWARD);
>>   VecScatterDestroy();
>>
>>   PetscScalar *avr;
>>   ierr = VecGetArray(vout,);CHKERRQ(ierr);
>>   ierr = PetscSortRealWithPermutation(siz,avr,idx);CHKERRQ(ierr);
>>
>>   /*Select out a piece of the resulting indices idx on each process; for
>> example with two processes I think rank = 0 would get the first half of the
>> idx and rank = 1 would get the second half.*/
>>
>>   PetscMPIInt rank,size;
>>   MPI_Comm_rank(PETSC_COMM_WORLD, );
>>   MPI_Comm_size(PETSC_COMM_WORLD, );
>>
>>   PetscInt mod;
>>   mod = siz % size;
>>
>>   PetscInt *idxx,ss;
>>   ss = (siz-mod)/size;
>>
>>   if (mod != 0){
>> if (rank> PetscMalloc1(ss+1,);
>> } else{
>> PetscMalloc1(ss,);
>> }
>>   } else{
>>   PetscMalloc1(ss,);
>>   }
>>
>>
>> j =0;
>> for (i=rank*ss; i<(rank+1)*ss; i++) {
>>   idxx[j] = idx[i];
>>  //PetscPrintf(PETSC_COMM_WORLD," idxx: %D\n",idxx[j]);
>>   j++;
>>
>>   if (mod != 0){
>> if (rank> idxx[ss+1] = idx[ss*size+rank+1];
>> }
>>   }
>>
>>   /*Permute matrix L (spy(A(p1,p1))*/
>>
>> if (mod != 0){
>> if (rank> ierr =
>> ISCreateGeneral(PETSC_COMM_WORLD,ss+1,idxx,PETSC_COPY_VALUES,);CHKERRQ(ierr);
>> } else{
>> ierr =
>> ISCreateGeneral(PETSC_COMM_WORLD,ss,idxx,PETSC_COPY_VALUES,);CHKERRQ(ierr);
>> }
>>
>> }else {
>> ierr =
>> ISCreateGeneral(PETSC_COMM_WORLD,ss,idxx,PETSC_COPY_VALUES,);CHKERRQ(ierr);
>> }
>

Re: [petsc-users] Argument out of range error in MatPermute

2019-04-24 Thread Eda Oktay via petsc-users
Dear Stefano,

Thank you for answering. When I used MatSetSizes, I got an error since the
matrix is read from outside, but from the error I understood that actually
the local sizes are 2127 and 2126, so I misunderstood the problem. I am
sorry for my mistake.

However, I still cannot understand where is the error. Because both
communicators and local sizes of IS and the matrix are the same. I still
get the same error in MatPermute:

[0]PETSC ERROR: Argument out of range
[0]PETSC ERROR: Index -1081207334 is out of range
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for
trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
[0]PETSC ERROR: ./TEKRAR_TEK_SAYI_SON_YENI_DENEME_TEMIZ_ENYENI_FINAL on a
arch-linux2-c-debug named 53d.wls.metu.edu.tr by edaoktay Wed Apr 24
11:22:15 2019
[0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
--download-metis --download-parmetis --download-superlu_dist
--download-slepc --download-mpich
[0]PETSC ERROR: #1 PetscLayoutFindOwner() line 248 in
/home/edaoktay/petsc-3.10.3/include/petscis.h
[0]PETSC ERROR: #2 MatPermute_MPIAIJ() line 1685 in
/home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
[0]PETSC ERROR: #3 MatPermute() line 4997 in
/home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
[0]PETSC ERROR: #4 main() line 361 in
/home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/TEKRAR_TEK_SAYI_SON_YENI_DENEME_TEMIZ_ENYENI_FINAL.c

This is the part of my program:

  ierr = MatCreateVecs(L,,NULL);CHKERRQ(ierr);
  ierr = EPSGetEigenpair(eps,0,,NULL,vr,NULL);
  ierr = PetscPrintf(PETSC_COMM_WORLD," The second smallest eigenvalue:
%g\n",kr);CHKERRQ(ierr);

  /* sort second smallest eigenvector */

  ierr = VecGetSize(vr,);CHKERRQ(ierr);
  ierr = PetscMalloc1(siz,);CHKERRQ(ierr);
  for (i=0; i, 22 Nis 2019 Pzt, 18:13
tarihinde şunu yazdı:

> If you are using PETSC_DECIDE for the local sizes in MatSetSizes, the
> default local sizes should be 2127 and 2126.
>
> Il giorno lun 22 apr 2019 alle ore 11:28 Eda Oktay via petsc-users <
> petsc-users@mcs.anl.gov> ha scritto:
>
>> Thank you for your answers. I figured out that for a matrix of size
>> 4253*4253, local size of Mat is 2127 and 2127 for 2 processors. However, I
>> wrote the program such that the local sizes of IS 2127 and 2126.
>>
>> Is local size of Mat being 2127 on both processors correct? If it is,
>> then I will change the local size of IS but then it will exceed the global
>> size of Mat. Isn't this also a problem?
>>
>> Thanks a lot,
>>
>> Eda
>>
>> Smith, Barry F. , 9 Nis 2019 Sal, 00:31 tarihinde
>> şunu yazdı:
>>
>>>
>>>   Suggest printing out the IS with ISView after it is created and
>>> confirming that 1) it is a permutation and 2) that the size of the IS on
>>> each process matches the number of rows on that process.
>>>
>>>   Note from the manual page: The index sets should be on the same
>>> communicator as Mat and have the same local sizes.
>>>
>>> Barry
>>>
>>>
>>> > On Apr 8, 2019, at 3:21 AM, Eda Oktay via petsc-users <
>>> petsc-users@mcs.anl.gov> wrote:
>>> >
>>> > Hello again,
>>> >
>>> > I solved the problem for even numbered sized matrices. However when
>>> the matrix size is odd, then number of elements in each index set at each
>>> processor are different. (For example, for size 4253*4253 and 2 processors,
>>> size of index set at processor 0 is 2127 where at processor 1, it is 2126)
>>> I think this is why, MatPermute again gives the same "Argument out of
>>> range" error. Index sets look like correct but I still did not get why I
>>> get this error.
>>> >
>>> > This is the part of my program:
>>> >
>>> >   PetscMPIInt rank,size;
>>> >   MPI_Comm_rank(PETSC_COMM_WORLD, );
>>> >   MPI_Comm_size(PETSC_COMM_WORLD, );
>>> >
>>> >   PetscInt mod;
>>> >   mod = siz % size;
>>> >
>>> >   PetscInt *idxx,ss;
>>> >   ss = (siz-mod)/size;
>>>
>>> >
>>> >   if (mod != 0){
>>> > if (rank>> > PetscMalloc1(ss+1,);
>>>
>>> > } else{
>>> > PetscMalloc1(ss,);
>>> > }
>>> >   }
>>> >
>>> >   if (rank != size-1) {
>>> > j =0;
>>> > for (i=rank*ss; i<(rank+1)*ss; i++) {
>>> >   idxx[j] = idx[i];
>>> >   j++;
>>> > }
>&

[petsc-users] Memory Corruption Error in MatPartitioningApply

2019-04-22 Thread Eda Oktay via petsc-users
Hello,

I am trying to partition an odd-numbered sized (for example 4253*4253),
square permutation matrix by using 2 processors with ParMETIS. The
permutation matrix is obtained by permuting the matrix by an index set "is"
(MatPermute(A,is,is,)). I checked the index set, it gives a permutation
and it is correct.

When I look at the local size of the matrix, it is given by 2127 and 2127
on each processor, so in order the local sizes of matrix and index sets to
be same, I defined the index sets' sizes as 2127 and 2127.

When I do that, I get memory corruption error in MatPartiitioningApply
function. The error is as follows:

[0]PETSC ERROR: PetscMallocValidate: error detected at
MatPartitioningApply_Parmetis_Private() line 141 in
/home/edaoktay/petsc-3.10.3/src/mat/partition/impls/pmetis/pmetis.c
[0]PETSC ERROR: Memory [id=0(8512)] at address 0x19e6870 is corrupted
(probably write past end of array)
[0]PETSC ERROR: Memory originally allocated in main() line 310 in
/home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/TEK_SAYI_SON_YENI_DENEME_TEMIZ_ENYENI_FINAL.c
[0]PETSC ERROR: - Error Message
--
[0]PETSC ERROR: Memory corruption:
http://www.mcs.anl.gov/petsc/documentation/installation.html#valgrind
[0]PETSC ERROR:
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for
trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
[0]PETSC ERROR: ./TEK_SAYI_SON_YENI_DENEME_TEMIZ_ENYENI_FINAL on a
arch-linux2-c-debug named 13ed.wls.metu.edu.tr by edaoktay Mon Apr 22
14:58:52 2019
[0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
--download-metis --download-parmetis --download-superlu_dist
--download-slepc --download-mpich
[0]PETSC ERROR: #1 PetscMallocValidate() line 146 in
/home/edaoktay/petsc-3.10.3/src/sys/memory/mtr.c
[0]PETSC ERROR: #2 MatPartitioningApply_Parmetis_Private() line 141 in
/home/edaoktay/petsc-3.10.3/src/mat/partition/impls/pmetis/pmetis.c
[0]PETSC ERROR: #3 MatPartitioningApply_Parmetis() line 215 in
/home/edaoktay/petsc-3.10.3/src/mat/partition/impls/pmetis/pmetis.c
[0]PETSC ERROR: #4 MatPartitioningApply() line 340 in
/home/edaoktay/petsc-3.10.3/src/mat/partition/partition.c
[0]PETSC ERROR: #5 main() line 374 in
/home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/TEK_SAYI_SON_YENI_DENEME_TEMIZ_ENYENI_FINAL.c
[0]PETSC ERROR: PETSc Option Table entries:
[0]PETSC ERROR: -f
/home/edaoktay/petsc-3.10.3/share/petsc/datafiles/matrices/binary_files/airfoil1_binary
[0]PETSC ERROR: -mat_partitioning_type parmetis
[0]PETSC ERROR: -unweighted
[0]PETSC ERROR: End of Error Message ---send entire
error message to petsc-ma...@mcs.anl.gov--


The line 310 is PetscMalloc1(ss,). The part of my program is written
as below:

  if (mod != 0){
  ss = (siz+1)/size;//(siz+size-mod)/size;
  } else{
  ss = siz/size;
  }

PetscMalloc1(ss,);   // LINE 310

  if (rank != size-1) {
j =0;
for (i=rank*ss; i<(rank+1)*ss; i++) {
  idxx[j] = idx[i];
  j++;
}

  } else {

j =0;
for (i=rank*ss; i

Re: [petsc-users] Argument out of range error in MatPermute

2019-04-22 Thread Eda Oktay via petsc-users
Thank you for your answers. I figured out that for a matrix of size
4253*4253, local size of Mat is 2127 and 2127 for 2 processors. However, I
wrote the program such that the local sizes of IS 2127 and 2126.

Is local size of Mat being 2127 on both processors correct? If it is, then
I will change the local size of IS but then it will exceed the global size
of Mat. Isn't this also a problem?

Thanks a lot,

Eda

Smith, Barry F. , 9 Nis 2019 Sal, 00:31 tarihinde şunu
yazdı:

>
>   Suggest printing out the IS with ISView after it is created and
> confirming that 1) it is a permutation and 2) that the size of the IS on
> each process matches the number of rows on that process.
>
>   Note from the manual page: The index sets should be on the same
> communicator as Mat and have the same local sizes.
>
> Barry
>
>
> > On Apr 8, 2019, at 3:21 AM, Eda Oktay via petsc-users <
> petsc-users@mcs.anl.gov> wrote:
> >
> > Hello again,
> >
> > I solved the problem for even numbered sized matrices. However when the
> matrix size is odd, then number of elements in each index set at each
> processor are different. (For example, for size 4253*4253 and 2 processors,
> size of index set at processor 0 is 2127 where at processor 1, it is 2126)
> I think this is why, MatPermute again gives the same "Argument out of
> range" error. Index sets look like correct but I still did not get why I
> get this error.
> >
> > This is the part of my program:
> >
> >   PetscMPIInt rank,size;
> >   MPI_Comm_rank(PETSC_COMM_WORLD, );
> >   MPI_Comm_size(PETSC_COMM_WORLD, );
> >
> >   PetscInt mod;
> >   mod = siz % size;
> >
> >   PetscInt *idxx,ss;
> >   ss = (siz-mod)/size;
>
> >
> >   if (mod != 0){
> > if (rank > PetscMalloc1(ss+1,);
> > } else{
> > PetscMalloc1(ss,);
> > }
> >   }
> >
> >   if (rank != size-1) {
> > j =0;
> > for (i=rank*ss; i<(rank+1)*ss; i++) {
> >   idxx[j] = idx[i];
> >   j++;
> > }
> >
> >   } else {
> >
> > j =0;
> > for (i=rank*ss; i >   idxx[j] = idx[i];
> >   j++;
> > }
> >
> >   }
> >
> >   if (mod != 0){
> > if (rank > idxx[ss+1] = idx[ss*size+rank+1];
> > }
> >   }
> >
> >   /*Permute matrix L (spy(A(p1,p1))*/
> >
> > if (mod != 0){
> > if (rank > ierr =
> ISCreateGeneral(PETSC_COMM_WORLD,ss+1,idxx,PETSC_COPY_VALUES,);CHKERRQ(ierr);
> > } else{
> > ierr =
> ISCreateGeneral(PETSC_COMM_WORLD,ss,idxx,PETSC_COPY_VALUES,);CHKERRQ(ierr);
> > }
> >   }
> >   ierr = ISSetPermutation(is);CHKERRQ(ierr);
> >
> >   ierr = MatPermute(A,is,is,);CHKERRQ(ierr);
> >
> > And I get the following error even if I use MatSetOption :
> >
> > [0]PETSC ERROR: - Error Message
> --
> > [0]PETSC ERROR: Argument out of range
> > [0]PETSC ERROR: New nonzero at (0,4252) caused a malloc
> > Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn
> off this check
> > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
> > [0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
> > [0]PETSC ERROR: ./SON_YENI_DENEME_TEMIZ_ENYENI_FINAL on a
> arch-linux2-c-debug named dd2b.wls.metu.edu.tr by edaoktay Mon Apr  8
> 11:10:59 2019
> > [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
> --with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
> --download-metis --download-parmetis --download-superlu_dist
> --download-slepc --download-mpich
> > [0]PETSC ERROR: #1 MatSetValues_MPIAIJ() line 617 in
> /home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
> > [0]PETSC ERROR: #2 MatSetValues() line 1349 in
> /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
> > [0]PETSC ERROR: #3 MatPermute_MPIAIJ() line 1714 in
> /home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
> > [0]PETSC ERROR: #4 MatPermute() line 4997 in
> /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
> > [0]PETSC ERROR: #5 main() line 352 in
> /home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/SON_YENI_DENEME_TEMIZ_ENYENI_FINAL.c
> > [0]PETSC ERROR: PETSc Option Table entries:
> > [0]PETSC ERROR: -f
> /home/edaoktay/petsc-3.10.3/share/petsc/datafiles/matrices/binary_files/airfoil1_binary
> > [0]PETSC ERROR: -mat_partitioning_type parmetis
> > [0]PETSC ERROR: -unweighted
> > [

Re: [petsc-users] Argument out of range error in MatPermute

2019-04-08 Thread Eda Oktay via petsc-users
Hello again,

I solved the problem for even numbered sized matrices. However when the
matrix size is odd, then number of elements in each index set at each
processor are different. (For example, for size 4253*4253 and 2 processors,
size of index set at processor 0 is 2127 where at processor 1, it is 2126)
I think this is why, MatPermute again gives the same "Argument out of
range" error. Index sets look like correct but I still did not get why I
get this error.

This is the part of my program:

  PetscMPIInt rank,size;
  MPI_Comm_rank(PETSC_COMM_WORLD, );
  MPI_Comm_size(PETSC_COMM_WORLD, );

  PetscInt mod;
  mod = siz % size;

  PetscInt *idxx,ss;
  ss = (siz-mod)/size;


  if (mod != 0){
if (rankhttp://www.mcs.anl.gov/petsc/documentation/faq.html for
trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
[0]PETSC ERROR: ./SON_YENI_DENEME_TEMIZ_ENYENI_FINAL on a
arch-linux2-c-debug named dd2b.wls.metu.edu.tr by edaoktay Mon Apr  8
11:10:59 2019
[0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
--download-metis --download-parmetis --download-superlu_dist
--download-slepc --download-mpich
[0]PETSC ERROR: #1 MatSetValues_MPIAIJ() line 617 in
/home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
[0]PETSC ERROR: #2 MatSetValues() line 1349 in
/home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
[0]PETSC ERROR: #3 MatPermute_MPIAIJ() line 1714 in
/home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
[0]PETSC ERROR: #4 MatPermute() line 4997 in
/home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
[0]PETSC ERROR: #5 main() line 352 in
/home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/SON_YENI_DENEME_TEMIZ_ENYENI_FINAL.c
[0]PETSC ERROR: PETSc Option Table entries:
[0]PETSC ERROR: -f
/home/edaoktay/petsc-3.10.3/share/petsc/datafiles/matrices/binary_files/airfoil1_binary
[0]PETSC ERROR: -mat_partitioning_type parmetis
[0]PETSC ERROR: -unweighted
[0]PETSC ERROR: End of Error Message ---send entire
error message to petsc-ma...@mcs.anl.gov--

Thanks!

Eda

Eda Oktay , 25 Mar 2019 Pzt, 13:53 tarihinde şunu
yazdı:

> I attached whole program I wrote where the problem is in line 285. One of
> the matrices I used was airfoil1_binary, included in the folder. Also, I
> included makefile. Is that what you want?
>
> Matthew Knepley , 25 Mar 2019 Pzt, 13:41 tarihinde
> şunu yazdı:
>
>> That should not happen. Can you send in a small example that we can debug.
>>
>>   Thanks,
>>
>> Matt
>>
>> On Mon, Mar 25, 2019 at 12:38 AM Eda Oktay via petsc-users <
>> petsc-users@mcs.anl.gov> wrote:
>>
>>> Hello,
>>>
>>> I am trying to permute a vector A using following lines:
>>>
>>> ierr =
>>> ISCreateGeneral(PETSC_COMM_SELF,siz,idx,PETSC_COPY_VALUES,);CHKERRQ(ierr);
>>>   ierr = ISSetPermutation(is);CHKERRQ(ierr);
>>>   ierr = ISDuplicate(is,);CHKERRQ(ierr);
>>>   ierr =
>>> MatSetOption(A,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr);
>>>   ierr = MatPermute(A,is,newIS,);CHKERRQ(ierr);
>>>
>>> However, in MatPermute line, I get the following error even if I used
>>> MatSetOption before this line:
>>>
>>> [0]PETSC ERROR: - Error Message
>>> --
>>> [0]PETSC ERROR: Argument out of range
>>> [0]PETSC ERROR: New nonzero at (0,485) caused a malloc
>>> Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn
>>> off this check
>>> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
>>> for trouble shooting.
>>> [0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
>>> [0]PETSC ERROR: ./DENEME_TEMIZ_ENYENI_FINAL on a arch-linux2-c-debug
>>> named 1232.wls.metu.edu.tr by edaoktay Mon Mar 25 12:15:14 2019
>>> [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
>>> --with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
>>> --download-metis --download-parmetis --download-superlu_dist
>>> --download-slepc --download-mpich
>>> [0]PETSC ERROR: #1 MatSetValues_MPIAIJ() line 579 in
>>> /home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
>>> [0]PETSC ERROR: #2 MatAssemblyEnd_MPIAIJ() line 807 in
>>> /home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
>>> [0]PETSC ERROR: #3 MatAssemblyEnd() line 5340 in
>>> /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
>>> [0]PETSC ERROR: #4 MatPermute_MPIAIJ() line 1723 in
>>> /home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
>>

Re: [petsc-users] error: Petsc has generated inconsistent data, MPI_Allreduce() called in different locations (code lines) on different processors

2019-04-07 Thread Eda Oktay via petsc-users
Dear Barry,

Thank you for answering. I am sending my code, makefile and 2 PETSc Binary
File where airfoil1_binary has odd numbered size (the one I got error) and
gr_30_30_binary has even numbered size (I got correct result). I got the
error for lines 164 and 169.

By the way, I think I have done something wrong at line 320 (I tried to
allocate an array twice) but I just need to reduce the error in 164 and 169
then I will get to reduce the error in line 320.

Thanks,

Eda


Smith, Barry F. , 6 Nis 2019 Cmt, 09:29 tarihinde şunu
yazdı:

>
>   Eda,
>
>Can you send us your code (and any needed data files)? We certainly
> expect PETSc to perform correctly if the size of the matrix cannot be
> divide by the number of processors. It is possible the problem is due to
> bugs either in MatStashScatterBegin_BTS() or in your code.
>
>Thanks
>
> Barry
>
>
> > On Apr 5, 2019, at 7:20 AM, Matthew Knepley via petsc-users <
> petsc-users@mcs.anl.gov> wrote:
> >
> > On Fri, Apr 5, 2019 at 3:20 AM Eda Oktay via petsc-users <
> petsc-users@mcs.anl.gov> wrote:
> > Hello,
> >
> > I am trying to calculate unweighted Laplacian of a matrix by using 2
> cores. If the size of matrix is in even number then my program works.
> However, when I try to use a matrix having odd number for size, I guess
> since size of the matrix cannot be divided into processors correctly, I get
> the following error:
> >
> > [0]PETSC ERROR: - Error Message
> --
> > [1]PETSC ERROR: - Error Message
> --
> > [1]PETSC ERROR: Petsc has generated inconsistent data
> > [1]PETSC ERROR: MPI_Allreduce() called in different locations (code
> lines) on different processors
> > [1]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
> > [1]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
> > [0]PETSC ERROR: Petsc has generated inconsistent data
> > [0]PETSC ERROR: MPI_Allreduce() called in different locations (code
> lines) on different processors
> > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
> > [0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
> > [0]PETSC ERROR: ./SON_YENI_DENEME_TEMIZ_ENYENI_FINAL on a
> arch-linux2-c-debug named dfa.wls.metu.edu.tr by edaoktay Fri Apr  5
> 09:50:54 2019
> > [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
> --with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
> --download-metis --download-parmetis --download-superlu_dist
> --download-slepc --download-mpich
> > [1]PETSC ERROR: ./SON_YENI_DENEME_TEMIZ_ENYENI_FINAL on a
> arch-linux2-c-debug named dfa.wls.metu.edu.tr by edaoktay Fri Apr  5
> 09:50:54 2019
> > [1]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
> --with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
> --download-metis --download-parmetis --download-superlu_dist
> --download-slepc --download-mpich
> > [1]PETSC ERROR: [0]PETSC ERROR: #1 MatSetOption() line 5505 in
> /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
> > #1 MatStashScatterBegin_BTS() line 843 in
> /home/edaoktay/petsc-3.10.3/src/mat/utils/matstash.c
> > [1]PETSC ERROR: [0]PETSC ERROR: #2 MatSetOption() line 5505 in
> /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
> > #2 MatStashScatterBegin_BTS() line 843 in
> /home/edaoktay/petsc-3.10.3/src/mat/utils/matstash.c
> > [1]PETSC ERROR: #3 MatStashScatterBegin_Private() line 462 in
> /home/edaoktay/petsc-3.10.3/src/mat/utils/matstash.c
> > [0]PETSC ERROR: #3 main() line 164 in
> /home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/SON_YENI_DENEME_TEMIZ_ENYENI_FINAL.c
> > [1]PETSC ERROR: #4 MatAssemblyBegin_MPIAIJ() line 774 in
> /home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
> > [1]PETSC ERROR: [0]PETSC ERROR: PETSc Option Table entries:
> > [0]PETSC ERROR: -f
> /home/edaoktay/petsc-3.10.3/share/petsc/datafiles/matrices/binary_files/airfoil1_binary
> > #5 MatAssemblyBegin() line 5251 in
> /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
> > [1]PETSC ERROR: [0]PETSC ERROR: -mat_partitioning_type parmetis
> > [0]PETSC ERROR: -unweighted
> > #6 main() line 169 in
> /home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/SON_YENI_DENEME_TEMIZ_ENYENI_FINAL.c
> > [1]PETSC ERROR: PETSc Option Table entries:
> > [1]PETSC ERROR: [0]PETSC ERROR: End of Error Message
> ---send entire error message to petsc-ma...@mcs.anl.gov--

[petsc-users] error: Petsc has generated inconsistent data, MPI_Allreduce() called in different locations (code lines) on different processors

2019-04-05 Thread Eda Oktay via petsc-users
Hello,

I am trying to calculate unweighted Laplacian of a matrix by using 2 cores.
If the size of matrix is in even number then my program works. However,
when I try to use a matrix having odd number for size, I guess since size
of the matrix cannot be divided into processors correctly, I get the
following error:

[0]PETSC ERROR: - Error Message
--
[1]PETSC ERROR: - Error Message
--
[1]PETSC ERROR: Petsc has generated inconsistent data
[1]PETSC ERROR: MPI_Allreduce() called in different locations (code lines)
on different processors
[1]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for
trouble shooting.
[1]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
[0]PETSC ERROR: Petsc has generated inconsistent data
[0]PETSC ERROR: MPI_Allreduce() called in different locations (code lines)
on different processors
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for
trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
[0]PETSC ERROR: ./SON_YENI_DENEME_TEMIZ_ENYENI_FINAL on a
arch-linux2-c-debug named dfa.wls.metu.edu.tr by edaoktay Fri Apr  5
09:50:54 2019
[0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
--download-metis --download-parmetis --download-superlu_dist
--download-slepc --download-mpich
[1]PETSC ERROR: ./SON_YENI_DENEME_TEMIZ_ENYENI_FINAL on a
arch-linux2-c-debug named dfa.wls.metu.edu.tr by edaoktay Fri Apr  5
09:50:54 2019
[1]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
--download-metis --download-parmetis --download-superlu_dist
--download-slepc --download-mpich
[1]PETSC ERROR: [0]PETSC ERROR: #1 MatSetOption() line 5505 in
/home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
#1 MatStashScatterBegin_BTS() line 843 in
/home/edaoktay/petsc-3.10.3/src/mat/utils/matstash.c
[1]PETSC ERROR: [0]PETSC ERROR: #2 MatSetOption() line 5505 in
/home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
#2 MatStashScatterBegin_BTS() line 843 in
/home/edaoktay/petsc-3.10.3/src/mat/utils/matstash.c
[1]PETSC ERROR: #3 MatStashScatterBegin_Private() line 462 in
/home/edaoktay/petsc-3.10.3/src/mat/utils/matstash.c
[0]PETSC ERROR: #3 main() line 164 in
/home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/SON_YENI_DENEME_TEMIZ_ENYENI_FINAL.c
[1]PETSC ERROR: #4 MatAssemblyBegin_MPIAIJ() line 774 in
/home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
[1]PETSC ERROR: [0]PETSC ERROR: PETSc Option Table entries:
[0]PETSC ERROR: -f
/home/edaoktay/petsc-3.10.3/share/petsc/datafiles/matrices/binary_files/airfoil1_binary
#5 MatAssemblyBegin() line 5251 in
/home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
[1]PETSC ERROR: [0]PETSC ERROR: -mat_partitioning_type parmetis
[0]PETSC ERROR: -unweighted
#6 main() line 169 in
/home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/SON_YENI_DENEME_TEMIZ_ENYENI_FINAL.c
[1]PETSC ERROR: PETSc Option Table entries:
[1]PETSC ERROR: [0]PETSC ERROR: End of Error Message
---send entire error message to petsc-ma...@mcs.anl.gov--
-f
/home/edaoktay/petsc-3.10.3/share/petsc/datafiles/matrices/binary_files/airfoil1_binary
[1]PETSC ERROR: -mat_partitioning_type parmetis
[1]PETSC ERROR: -unweighted
[1]PETSC ERROR: application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0
End of Error Message ---send entire error message to
petsc-ma...@mcs.anl.gov--
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 1


 where line 164 in my main program is MatSetOption and line 169
is MatAssemblyBegin. I am new to MPI usage so I did not understand why
MPI_Allreduce() causes a problem and how can I fix the problem.

Thank you,

Eda


Re: [petsc-users] Local and global size of IS

2019-04-02 Thread Eda Oktay via petsc-users
Hi Mark,

siz%size = 0 in my case because siz=362 and I use at most 2 processors.

Mark Adams , 2 Nis 2019 Sal, 15:12 tarihinde şunu yazdı:

>
>
> On Tue, Apr 2, 2019 at 6:55 AM Eda Oktay via petsc-users <
> petsc-users@mcs.anl.gov> wrote:
>
>> Hi Barry,
>>
>> I did what you said but now I get the error in ISSetPermutation that
>> index set is not a permutation. ı think it is because since I selected
>> indices on each process as you said. I did the following, did I understand
>> you wrong:
>>
>>   PetscMPIInt rank,size;
>>   MPI_Comm_rank(PETSC_COMM_WORLD, );
>>   MPI_Comm_size(PETSC_COMM_WORLD, );
>>
>>   PetscInt *idxx,ss;
>>   ss = siz/size;
>>   PetscMalloc1(ss,);
>>   if (rank != size-1) {
>> j =0;
>> for (i=rank*ss; i<(rank+1)*ss; i++) {
>>   idxx[j] = idx[i];
>>   j++;
>> }
>>
>>   } else {
>>
>> j =0;
>> for (i=rank*ss; i>   idxx[j] = idx[i];
>>
>
> if siz%size != 0, you will run off the end of idxx, that is you have a
> memory error.
>
>


Re: [petsc-users] Local and global size of IS

2019-04-02 Thread Eda Oktay via petsc-users
Hi Barry,

I did what you said but now I get the error in ISSetPermutation that index
set is not a permutation. ı think it is because since I selected indices on
each process as you said. I did the following, did I understand you wrong:

  PetscMPIInt rank,size;
  MPI_Comm_rank(PETSC_COMM_WORLD, );
  MPI_Comm_size(PETSC_COMM_WORLD, );

  PetscInt *idxx,ss;
  ss = siz/size;
  PetscMalloc1(ss,);
  if (rank != size-1) {
j =0;
for (i=rank*ss; i<(rank+1)*ss; i++) {
  idxx[j] = idx[i];
  j++;
}

  } else {

j =0;
for (i=rank*ss; i, 31 Mar 2019 Paz, 01:47 tarihinde şunu
yazdı:

>
>
> > On Mar 27, 2019, at 7:33 AM, Eda Oktay via petsc-users <
> petsc-users@mcs.anl.gov> wrote:
> >
> > Hello,
> >
> > I am trying to permute a matrix A(of size 2n*2n) according to a sorted
> eigenvector vr (of size 2n) in parallel using 2 processors (processor
> number can change).
>
> I don't understand your rational for wanting to permute the matrix
> rows/columns based on a sorted eigenvector?
>
> > However, I get an error in MatPermute line stating that arguments are
> out of range and a new nonzero caused a malloc even if I used MatSetOption.
> >
> > I discovered that this may be because of the unequality of local sizes
> of is (and newIS) and local size of A.
> >
> > Since I allocate index set idx according to size of the vector vr,
> global size of is becomes 2n and the local size is also 2n (I think it
> should be n since both A and vr has local sizes n because of the number of
> processors). If I change the size of idx, then because of VecGetArrayRead,
> I think is is created wrongly.
> >
> > So, how can I make both global and local sizes of is,newIS and A?
> >
> > Below, you can see the part of my program.
> >
> > Thanks,
> >
> > Eda
> >
> >  ierr = VecGetSize(vr,);CHKERRQ(ierr);
> >   ierr = PetscMalloc1(siz,);CHKERRQ(ierr);
> >   for (i=0; i
>VecGetArray only gives you access to the local portion of the vector,
> not the entire vector so you cannot do the next two lines of code
> >   ierr = VecGetArrayRead(vr,);CHKERRQ(ierr);
>
>The sort routine is sequential; it knows nothing about parallelism so
> each process is just sorting its part. Hence this code won't work as
> expected
>
> >   ierr = PetscSortRealWithPermutation(siz,avr,idx);CHKERRQ(ierr);
>
>If you need to sort the parallel vector and get the entire permutation
> then you need to do the following
>
> 1)   communicate the entire vector to each process, you can use
> VecScatterCreateToAll() for this
> 2)   call VecGetArray on the new vector (that contains all entries on each
> process)
> 3)   Call PetscSortRealWithPermutation() on the entire vector on each
> process
> 4)   select out a piece of the resulting indices idx on each process; for
> example with two processes I think rank = 0 would get the first half of the
> idx and rank = 1 would get the second half.
> >
> >   ierr =
> ISCreateGeneral(PETSC_COMM_SELF,siz,idx,PETSC_COPY_VALUES,);CHKERRQ(ierr);
>
> >   ierr = ISSetPermutation(is);CHKERRQ(ierr);
>
>   You don't need to duplicate the is, just pass it in twice.
>
> >   ierr = ISDuplicate(is,);CHKERRQ(ierr);
>
>You should definitely not need the next line. The A matrix is untouched
> by the subroutine call so you don't need to change its allocation options
>
> >
> MatSetOption(A,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr);
> >   ierr = MatPermute(A,is,newIS,);CHKERRQ(ierr);
>
>


[petsc-users] Local and global size of IS

2019-03-27 Thread Eda Oktay via petsc-users
Hello,

I am trying to permute a matrix A(of size 2n*2n) according to a sorted
eigenvector vr (of size 2n) in parallel using 2 processors (processor
number can change). However, I get an error in MatPermute line stating that
arguments are out of range and a new nonzero caused a malloc even if I used
MatSetOption.

I discovered that this may be because of the unequality of local sizes of
is (and newIS) and local size of A.

Since I allocate index set idx according to size of the vector vr, global
size of is becomes 2n and the local size is also 2n (I think it should be n
since both A and vr has local sizes n because of the number of processors).
If I change the size of idx, then because of VecGetArrayRead, I think is is
created wrongly.

So, how can I make both global and local sizes of is,newIS and A?

Below, you can see the part of my program.

Thanks,

Eda

 ierr = VecGetSize(vr,);CHKERRQ(ierr);
  ierr = PetscMalloc1(siz,);CHKERRQ(ierr);
  for (i=0; i

Re: [petsc-users] Argument out of range error in MatPermute

2019-03-25 Thread Eda Oktay via petsc-users
I attached whole program I wrote where the problem is in line 285. One of
the matrices I used was airfoil1_binary, included in the folder. Also, I
included makefile. Is that what you want?

Matthew Knepley , 25 Mar 2019 Pzt, 13:41 tarihinde şunu
yazdı:

> That should not happen. Can you send in a small example that we can debug.
>
>   Thanks,
>
> Matt
>
> On Mon, Mar 25, 2019 at 12:38 AM Eda Oktay via petsc-users <
> petsc-users@mcs.anl.gov> wrote:
>
>> Hello,
>>
>> I am trying to permute a vector A using following lines:
>>
>> ierr =
>> ISCreateGeneral(PETSC_COMM_SELF,siz,idx,PETSC_COPY_VALUES,);CHKERRQ(ierr);
>>   ierr = ISSetPermutation(is);CHKERRQ(ierr);
>>   ierr = ISDuplicate(is,);CHKERRQ(ierr);
>>   ierr =
>> MatSetOption(A,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr);
>>   ierr = MatPermute(A,is,newIS,);CHKERRQ(ierr);
>>
>> However, in MatPermute line, I get the following error even if I used
>> MatSetOption before this line:
>>
>> [0]PETSC ERROR: - Error Message
>> --
>> [0]PETSC ERROR: Argument out of range
>> [0]PETSC ERROR: New nonzero at (0,485) caused a malloc
>> Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn
>> off this check
>> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
>> for trouble shooting.
>> [0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
>> [0]PETSC ERROR: ./DENEME_TEMIZ_ENYENI_FINAL on a arch-linux2-c-debug
>> named 1232.wls.metu.edu.tr by edaoktay Mon Mar 25 12:15:14 2019
>> [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
>> --with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
>> --download-metis --download-parmetis --download-superlu_dist
>> --download-slepc --download-mpich
>> [0]PETSC ERROR: #1 MatSetValues_MPIAIJ() line 579 in
>> /home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
>> [0]PETSC ERROR: #2 MatAssemblyEnd_MPIAIJ() line 807 in
>> /home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
>> [0]PETSC ERROR: #3 MatAssemblyEnd() line 5340 in
>> /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
>> [0]PETSC ERROR: #4 MatPermute_MPIAIJ() line 1723 in
>> /home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
>> [0]PETSC ERROR: #5 MatPermute() line 4997 in
>> /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
>> [0]PETSC ERROR: #6 main() line 285 in
>> /home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/DENEME_TEMIZ_ENYENI_FINAL.c
>> [0]PETSC ERROR: PETSc Option Table entries:
>> [0]PETSC ERROR: -f
>> /home/edaoktay/petsc-3.10.3/share/petsc/datafiles/matrices/binary_files/airfoil1_binary
>> [0]PETSC ERROR: -mat_partitioning_type parmetis
>> [0]PETSC ERROR: -weighted
>> [0]PETSC ERROR: End of Error Message ---send entire
>> error message to petsc-ma...@mcs.anl.gov--
>>
>> I'll be glad if you can help me.
>>
>> Thanks!
>>
>> Eda
>>
>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>
<>


[petsc-users] Argument out of range error in MatPermute

2019-03-25 Thread Eda Oktay via petsc-users
Hello,

I am trying to permute a vector A using following lines:

ierr =
ISCreateGeneral(PETSC_COMM_SELF,siz,idx,PETSC_COPY_VALUES,);CHKERRQ(ierr);
  ierr = ISSetPermutation(is);CHKERRQ(ierr);
  ierr = ISDuplicate(is,);CHKERRQ(ierr);
  ierr =
MatSetOption(A,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr);
  ierr = MatPermute(A,is,newIS,);CHKERRQ(ierr);

However, in MatPermute line, I get the following error even if I used
MatSetOption before this line:

[0]PETSC ERROR: - Error Message
--
[0]PETSC ERROR: Argument out of range
[0]PETSC ERROR: New nonzero at (0,485) caused a malloc
Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn
off this check
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for
trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
[0]PETSC ERROR: ./DENEME_TEMIZ_ENYENI_FINAL on a arch-linux2-c-debug named
1232.wls.metu.edu.tr by edaoktay Mon Mar 25 12:15:14 2019
[0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
--download-metis --download-parmetis --download-superlu_dist
--download-slepc --download-mpich
[0]PETSC ERROR: #1 MatSetValues_MPIAIJ() line 579 in
/home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
[0]PETSC ERROR: #2 MatAssemblyEnd_MPIAIJ() line 807 in
/home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
[0]PETSC ERROR: #3 MatAssemblyEnd() line 5340 in
/home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
[0]PETSC ERROR: #4 MatPermute_MPIAIJ() line 1723 in
/home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c
[0]PETSC ERROR: #5 MatPermute() line 4997 in
/home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
[0]PETSC ERROR: #6 main() line 285 in
/home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/DENEME_TEMIZ_ENYENI_FINAL.c
[0]PETSC ERROR: PETSc Option Table entries:
[0]PETSC ERROR: -f
/home/edaoktay/petsc-3.10.3/share/petsc/datafiles/matrices/binary_files/airfoil1_binary
[0]PETSC ERROR: -mat_partitioning_type parmetis
[0]PETSC ERROR: -weighted
[0]PETSC ERROR: End of Error Message ---send entire
error message to petsc-ma...@mcs.anl.gov--

I'll be glad if you can help me.

Thanks!

Eda


Re: [petsc-users] petscmat.h: No such file or directory

2019-03-20 Thread Eda Oktay via petsc-users
Before using mpicc, I just tried to compile with make DENEME_ENYENI-FINAL.c
but it says there is nothing to do.

On Wed, Mar 20, 2019, 12:39 PM Jose E. Roman  wrote:

> You must compile your program with 'make DENEME_TEMIZ_ENYENI_FINAL' or
> just 'make', not with 'mpicc DENEME_TEMIZ_ENYENI_FINAL.c'
>
> > El 20 mar 2019, a las 8:25, Eda Oktay via petsc-users <
> petsc-users@mcs.anl.gov> escribió:
> >
> > Hello,
> >
> > I am trying to compile a parallel program DENEME_TEMIZ_ENYENI_FINAL.c in
> PETSc. I wrote the following makefile but it says that there is nothing to
> do with the program:
> >
> > export CLINKER = gcc
> >
> > DENEME_TEMIZ_ENYENI_FINAL: DENEME_TEMIZ_ENYENI_FINAL.o chkopts
> >   -${CLINKER} -o DENEME_TEMIZ_ENYENI_FINAL
> DENEME_TEMIZ_ENYENI_FINAL.o ${SLEPC_SYS_LIB}
> >   ${RM} DENEME_TEMIZ_ENYENI_FINAL.o
> > include ${SLEPC_DIR}/lib/slepc/conf/slepc_common
> >
> > Then I tried to compile it via mpicc DENEME_TEMIZ_ENYENI_FINAL.c
> > but I got the error "petscmat.h: No such file or directory".
> >
> > I wrote the following lines before compiling the program:
> > export PETSC_DIR=/home/slurm_local/e200781/petsc-3.10.3
> > export
> SLEPC_DIR=/home/slurm_local/e200781/petsc-3.10.3/arch-linux2-c-debug
> > export PETSC_ARCH=arch-linux2-c-debug
> >
> > Why I cannot compile the program?
> >
> > Thanks,
> >
> > Eda
> >
>
>


[petsc-users] MatGetRow_MPIAIJ error

2019-03-20 Thread Eda Oktay via petsc-users
Hello,

I wrote a code computing element wise absolute value of a matrix. When I
run the code sequentially, it works. However, when I try to use it in
parallel with the same matrix, I get the following error:

[1]PETSC ERROR: Argument out of range
[1]PETSC ERROR: Only local rows

The absolute value code is:

ierr = MatGetSize(A,,NULL);CHKERRQ(ierr);
ierr = MatDuplicate(A,MAT_COPY_VALUES,AbsA);CHKERRQ(ierr);

  for (i=0; i

[petsc-users] petscmat.h: No such file or directory

2019-03-20 Thread Eda Oktay via petsc-users
Hello,

I am trying to compile a parallel program DENEME_TEMIZ_ENYENI_FINAL.c in
PETSc. I wrote the following makefile but it says that there is nothing to
do with the program:

export CLINKER = gcc

DENEME_TEMIZ_ENYENI_FINAL: DENEME_TEMIZ_ENYENI_FINAL.o chkopts
-${CLINKER} -o DENEME_TEMIZ_ENYENI_FINAL DENEME_TEMIZ_ENYENI_FINAL.o
${SLEPC_SYS_LIB}
${RM} DENEME_TEMIZ_ENYENI_FINAL.o
include ${SLEPC_DIR}/lib/slepc/conf/slepc_common

Then I tried to compile it via mpicc DENEME_TEMIZ_ENYENI_FINAL.c
but I got the error "petscmat.h: No such file or directory".

I wrote the following lines before compiling the program:
export PETSC_DIR=/home/slurm_local/e200781/petsc-3.10.3
export SLEPC_DIR=/home/slurm_local/e200781/petsc-3.10.3/arch-linux2-c-debug
export PETSC_ARCH=arch-linux2-c-debug

Why I cannot compile the program?

Thanks,

Eda


Re: [petsc-users] SLEPc Build Error

2019-03-20 Thread Eda Oktay via petsc-users
Dear Professor Roman,

I decided to install petsc-3.10.3 with slepc since I did it once
succesfully. Thanks for your help.

Eda

Jose E. Roman , 19 Mar 2019 Sal, 15:15 tarihinde şunu
yazdı:

> What is the output of 'make check' in $PETSC_DIR ?
>
> > El 19 mar 2019, a las 13:02, Eda Oktay  escribió:
> >
> > Without slepc, I configured petsc succesfully. Then I installed slepc
> with following steps:
> >
> > export PETSC_ARCH=arch-linux2-c-debug
> > export PETSC_DIR=/home/slurm_local/e200781/petsc-3.10.4
> > export SLEPC_DIR=/home/slurm_local/e200781/slepc-3.10.2
> > cd slepc-3.10.2
> > ./configure
> >
> > However, I still get the error:
> >
> > Checking environment... done
> > Checking PETSc installation...
> > ERROR: Unable to link with PETSc
> > ERROR: See "arch-linux2-c-debug/lib/slepc/conf/configure.log" file for
> details
> >
> > Where the configure.log is:
> >
> >
> 
> > Starting Configure Run at Tue Mar 19 14:57:21 2019
> > Configure Options:
> > Working directory: /home/slurm_local/e200781/slepc-3.10.2
> > Python version:
> > 2.7.9 (default, Sep 25 2018, 20:42:16)
> > [GCC 4.9.2]
> > make: /usr/bin/make
> > PETSc source directory: /home/slurm_local/e200781/petsc-3.10.4
> > PETSc install directory:
> /home/slurm_local/e200781/petsc-3.10.4/arch-linux2-c-debug
> > PETSc version: 3.10.4
> > PETSc architecture: arch-linux2-c-debug
> > SLEPc source directory: /home/slurm_local/e200781/slepc-3.10.2
> > SLEPc version: 3.10.2
> >
> 
> > Checking PETSc installation...
> > #include "petscsnes.h"
> > int main() {
> > Vec v; Mat m; KSP k;
> > PetscInitializeNoArguments();
> > VecCreate(PETSC_COMM_WORLD,);
> > MatCreate(PETSC_COMM_WORLD,);
> > KSPCreate(PETSC_COMM_WORLD,);
> > return 0;
> > }
> > /home/slurm_local/e200781/petsc-3.10.4/arch-linux2-c-debug/bin/mpicc -o
> checklink.o -c -fPIC  -Wall -Wwrite-strings -Wno-strict-aliasing
> -Wno-unknown-pragmas -fstack-protector -fvisibility=hidden -g3
>  -I/home/slurm_local/e200781/petsc-3.10.4/include
> -I/home/slurm_local/e200781/petsc-3.10.4/arch-linux2-c-debug/include
> `pwd`/checklink.c
> > /home/slurm_local/e200781/petsc-3.10.4/arch-linux2-c-debug/bin/mpicc
> -fPIC  -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas
> -fstack-protector -fvisibility=hidden -g3  -o checklink checklink.o
> -Wl,-rpath,/home/slurm_local/e200781/petsc-3.10.4/arch-linux2-c-debug/lib
> -L/home/slurm_local/e200781/petsc-3.10.4/arch-linux2-c-debug/lib
> -Wl,-rpath,/home/slurm_local/e200781/petsc-3.10.4/arch-linux2-c-debug/lib
> -L/home/slurm_local/e200781/petsc-3.10.4/arch-linux2-c-debug/lib
> -Wl,-rpath,/usr/lib/gcc/x86_64-linux-gnu/4.9
> -L/usr/lib/gcc/x86_64-linux-gnu/4.9 -Wl,-rpath,/usr/lib/x86_64-linux-gnu
> -L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/lib/x86_64-linux-gnu
> -L/lib/x86_64-linux-gnu -lpetsc -lopenblas -lparmetis -lmetis -lm -lX11
> -lstdc++ -ldl -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi
> -lgfortran -lm -lgfortran -lm -lgcc_s -lquadmath -lpthread -lstdc++ -ldl
> > /usr/bin/ld: warning: libmpi.so.0, needed by
> /home/slurm_local/e200781/petsc-3.10.4/arch-linux2-c-debug/lib/libopenblas.so,
> may conflict with libmpi.so.40
> > /usr/bin/ld: warning: libmpi.so.0, needed by
> /home/slurm_local/e200781/petsc-3.10.4/arch-linux2-c-debug/lib/libopenblas.so,
> may conflict with libmpi.so.40
> >
> /home/slurm_local/e200781/petsc-3.10.4/arch-linux2-c-debug/lib/libpetsc.so:
> undefined reference to `MatPartitioningParmetisSetRepartition'
> >
> /home/slurm_local/e200781/petsc-3.10.4/arch-linux2-c-debug/lib/libpetsc.so:
> undefined reference to `MatPartitioningCreate_Parmetis'
> > collect2: error: ld returned 1 exit status
> > makefile:2: recipe for target 'checklink' failed
> > make: *** [checklink] Error 1
> >
> > ERROR: Unable to link with PETSc
> >
> > Jose E. Roman , 19 Mar 2019 Sal, 14:08 tarihinde
> şunu yazdı:
> > There seems to be a link problem with PETSc.
> > Suggest re-configuring without the option --download-slepc
> > Then, after building PETSc, try 'make check' to make sure that PETSc is
> built correctly. Then install SLEPc afterwards.
> > Jose
> >
> >
> > > El 19 mar 2019, a las 11:58, Eda Oktay 
> escribió:
> > >
> > >
> 
> > > Starting Configure Run at Tue Mar 19 11:53:05 2

Re: [petsc-users] SLEPc Build Error

2019-03-19 Thread Eda Oktay via petsc-users
This is slepc.log:

Checking environment... done
Checking PETSc installation...
ERROR: Unable to link with PETSc
ERROR: See "arch-linux2-c-debug/lib/slepc/conf/configure.log" file for
details



Matthew Knepley , 19 Mar 2019 Sal, 13:36 tarihinde şunu
yazdı:

> On Tue, Mar 19, 2019 at 6:31 AM Eda Oktay via petsc-users <
> petsc-users@mcs.anl.gov> wrote:
>
>> Hello,
>>
>> I am trying to install PETSc with following configure options:
>>
>> ./configure --download-openmpi --download-openblas --download-slepc
>> --download-cmake --download-metis --download-parmetis
>>
>> Compilation is done but after the following command, I got an error:
>>
>> make PETSC_DIR=/home/slurm_local/e200781/petsc-3.10.4
>> PETSC_ARCH=arch-linux2-c-debug all
>>
>> *** Building slepc ***
>> **ERROR*
>> Error building slepc. Check arch-linux2-c-debug/lib/petsc/conf/slepc.log
>>
>
> We need slepc.log
>
>   Thanks,
>
>  Matt
>
>
>> 
>> /home/slurm_local/e200781/petsc-3.10.4/arch-linux2-c-debug/lib/petsc/conf/petscrules:46:
>> recipe for target 'slepcbuild' failed
>> make[1]: *** [slepcbuild] Error 1
>> make[1]: Leaving directory '/home/slurm_local/e200781/petsc-3.10.4'
>> **ERROR*
>>   Error during compile, check arch-linux2-c-debug/lib/petsc/conf/make.log
>>   Send it and arch-linux2-c-debug/lib/petsc/conf/configure.log to
>> petsc-ma...@mcs.anl.gov
>> 
>> makefile:30: recipe for target 'all' failed
>> make: *** [all] Error 1
>>
>> How can I fix the problem?
>>
>> Thank you,
>>
>> Eda
>>
>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>


[petsc-users] SLEPc Build Error

2019-03-19 Thread Eda Oktay via petsc-users
Hello,

I am trying to install PETSc with following configure options:

./configure --download-openmpi --download-openblas --download-slepc
--download-cmake --download-metis --download-parmetis

Compilation is done but after the following command, I got an error:

make PETSC_DIR=/home/slurm_local/e200781/petsc-3.10.4
PETSC_ARCH=arch-linux2-c-debug all

*** Building slepc ***
**ERROR*
Error building slepc. Check arch-linux2-c-debug/lib/petsc/conf/slepc.log

/home/slurm_local/e200781/petsc-3.10.4/arch-linux2-c-debug/lib/petsc/conf/petscrules:46:
recipe for target 'slepcbuild' failed
make[1]: *** [slepcbuild] Error 1
make[1]: Leaving directory '/home/slurm_local/e200781/petsc-3.10.4'
**ERROR*
  Error during compile, check arch-linux2-c-debug/lib/petsc/conf/make.log
  Send it and arch-linux2-c-debug/lib/petsc/conf/configure.log to
petsc-ma...@mcs.anl.gov

makefile:30: recipe for target 'all' failed
make: *** [all] Error 1

How can I fix the problem?

Thank you,

Eda


[petsc-users] Matrix Partitioning using PARMETIS

2019-03-12 Thread Eda Oktay via petsc-users
Hello,

I have a Laplacian matrix PL of matrix A and I try to partition A using
PARMETIS. Since PL is sequential and not adjacency matrix, I converted PL
to AL, then write the following code:

  ierr = MatConvert(PL,MATMPIADJ,MAT_INITIAL_MATRIX,);CHKERRQ(ierr);

  ierr = MatMeshToCellGraph(AL,2,);CHKERRQ(ierr);
  ierr = MatPartitioningCreate(MPI_COMM_WORLD,);CHKERRQ(ierr);
  ierr = MatPartitioningSetAdjacency(part,dual);CHKERRQ(ierr);

  ierr = MatPartitioningSetFromOptions(part);CHKERRQ(ierr);
  ierr = MatPartitioningApply(part,);CHKERRQ(ierr);
  ierr = ISView(partitioning,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);

  ierr = ISDestroy();CHKERRQ(ierr);
  ierr = MatPartitioningDestroy();CHKERRQ(ierr);

However, when I look at partitioning with ISView, the index set consists of
zeros only. Is that because I have only one processor and my codes are
written for only one processor, or is there another problem? I ran my code
with -mat_partitioning_type parmetis.

Thanks,

Eda


Re: [petsc-users] Problem in MatSetValues

2019-03-11 Thread Eda Oktay via petsc-users
Dear Matt,

I understood that you are right. I changed sizeof(values) with ncols, it
gives matrix correctly.

However, now I get an error in EPSGetEigenpair:

0]PETSC ERROR: - Error Message
--
[0]PETSC ERROR: Argument out of range
[0]PETSC ERROR: Argument 2 out of range
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for
trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
[0]PETSC ERROR: ./ENYENI_FINAL on a arch-linux2-c-debug named
70a.wls.metu.edu.tr by edaoktay Mon Mar 11 16:17:25 2019
[0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
--download-metis --download-parmetis --download-superlu_dist
--download-slepc --download-mpich
[0]PETSC ERROR: #1 EPSGetEigenpair() line 398 in
/home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/externalpackages/git.slepc/src/eps/interface/epssolve.c

I understood from this error that the matrix does not converge. However, I
tested in MATLAB and it converges. The matrix is true now, so this cannot
be from the matrix.

Thanks,

Eda

Eda Oktay , 11 Mar 2019 Pzt, 16:07 tarihinde şunu
yazdı:

> Dear Matt,
>
> I printed in wrong state, ncols gives right solution.
>
> But I still can't understand the first problem.
>
> Eda
>
> Eda Oktay , 11 Mar 2019 Pzt, 16:05 tarihinde şunu
> yazdı:
>
>> Dear Matt,
>>
>> Thank you for answering. First of all, sizeof(vals) returns to number of
>> entries, I checked. Secondly, I found a problem:
>>
>> ncols gives me 6.95328e-310. However, I checked the matrix L, it was
>> computed properly.
>>
>> Why can ncols give such a value?
>>
>> Thanks,
>>
>> Eda
>>
>> Matthew Knepley , 11 Mar 2019 Pzt, 15:56 tarihinde
>> şunu yazdı:
>>
>>> On Mon, Mar 11, 2019 at 8:27 AM Eda Oktay via petsc-users <
>>> petsc-users@mcs.anl.gov> wrote:
>>>
>>>> Hello,
>>>>
>>>> I have a following part of a code which tries to change the nonzero
>>>> values of matrix L with -1. However in MatSetValues line, something happens
>>>> and some of the values in matrix turns into 1.99665e-314 instead of -1.
>>>> Type of arr is defined as PetscScalar and arr is produced correctly. What
>>>> can be the problem, is there a mistake about types?
>>>>
>>>> Thanks,
>>>>
>>>> Eda
>>>>
>>>>
>>>> for(rw = mm; rw>>>
>>>> ierr = MatGetRow(L,rw,,,);CHKERRQ(ierr);
>>>>
>>>> s = sizeof(vals);
>>>>
>>>
>>> This is wrong. sizeof(vals) gives bytes, not entries. Why don't you just
>>> use ncols here?
>>>
>>>   Matt
>>>
>>>
>>>> ierr = PetscMalloc1(s,);CHKERRQ(ierr);
>>>>
>>>> for(j=0;j>>>
>>>> arr[j]=-1.0;
>>>> }
>>>> ierr =
>>>> MatSetValues(NSymmA,1,,ncols,cols,arr,INSERT_VALUES);CHKERRQ(ierr);
>>>> ierr = MatRestoreRow(L,rw,,,);CHKERRQ(ierr);
>>>> }
>>>>
>>>
>>>
>>> --
>>> 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
>>>
>>> https://www.cse.buffalo.edu/~knepley/
>>> <http://www.cse.buffalo.edu/~knepley/>
>>>
>>


Re: [petsc-users] Problem in MatSetValues

2019-03-11 Thread Eda Oktay via petsc-users
Dear Matt,

I printed in wrong state, ncols gives right solution.

But I still can't understand the first problem.

Eda

Eda Oktay , 11 Mar 2019 Pzt, 16:05 tarihinde şunu
yazdı:

> Dear Matt,
>
> Thank you for answering. First of all, sizeof(vals) returns to number of
> entries, I checked. Secondly, I found a problem:
>
> ncols gives me 6.95328e-310. However, I checked the matrix L, it was
> computed properly.
>
> Why can ncols give such a value?
>
> Thanks,
>
> Eda
>
> Matthew Knepley , 11 Mar 2019 Pzt, 15:56 tarihinde
> şunu yazdı:
>
>> On Mon, Mar 11, 2019 at 8:27 AM Eda Oktay via petsc-users <
>> petsc-users@mcs.anl.gov> wrote:
>>
>>> Hello,
>>>
>>> I have a following part of a code which tries to change the nonzero
>>> values of matrix L with -1. However in MatSetValues line, something happens
>>> and some of the values in matrix turns into 1.99665e-314 instead of -1.
>>> Type of arr is defined as PetscScalar and arr is produced correctly. What
>>> can be the problem, is there a mistake about types?
>>>
>>> Thanks,
>>>
>>> Eda
>>>
>>>
>>> for(rw = mm; rw>>
>>> ierr = MatGetRow(L,rw,,,);CHKERRQ(ierr);
>>>
>>> s = sizeof(vals);
>>>
>>
>> This is wrong. sizeof(vals) gives bytes, not entries. Why don't you just
>> use ncols here?
>>
>>   Matt
>>
>>
>>> ierr = PetscMalloc1(s,);CHKERRQ(ierr);
>>>
>>> for(j=0;j>>
>>> arr[j]=-1.0;
>>> }
>>> ierr =
>>> MatSetValues(NSymmA,1,,ncols,cols,arr,INSERT_VALUES);CHKERRQ(ierr);
>>> ierr = MatRestoreRow(L,rw,,,);CHKERRQ(ierr);
>>> }
>>>
>>
>>
>> --
>> 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
>>
>> https://www.cse.buffalo.edu/~knepley/
>> <http://www.cse.buffalo.edu/~knepley/>
>>
>


[petsc-users] Problem in MatSetValues

2019-03-11 Thread Eda Oktay via petsc-users
Hello,

I have a following part of a code which tries to change the nonzero values
of matrix L with -1. However in MatSetValues line, something happens and
some of the values in matrix turns into 1.99665e-314 instead of -1. Type of
arr is defined as PetscScalar and arr is produced correctly. What can be
the problem, is there a mistake about types?

Thanks,

Eda


for(rw = mm; rw

Re: [petsc-users] EPSGetEigenpair Problem

2019-03-09 Thread Eda Oktay via petsc-users
Dear Matt,

Thank you for your example. I didn't compile your program since I fixed my
problem, now I get a value. However, now I get a different error:

[0]PETSC ERROR: Argument out of range
[0]PETSC ERROR: Argument 2 out of range
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for
trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
[0]PETSC ERROR: ./ENYENI_FINAL on a arch-linux2-c-debug named
localhost.localdomain by edaoktay Sat Mar  9 17:55:23 2019
[0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
--download-metis --download-parmetis --download-superlu_dist
--download-slepc --download-mpich
[0]PETSC ERROR: #1 EPSGetEigenpair() line 398 in
/home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/externalpackages/git.slepc/src/eps/interface/epssolve.c

I didn't understand why the arguments are out of range. I used this
function as:

ierr = EPSGetEigenpair(eps,0,,NULL,vr,NULL);

By the way, even though I get this error, I think EPSGetEigenpair computes
something since I get 4.07265e-314 (which is obviously not true) as the
second smallest eigenvalue.

Thanks,

Eda


Matthew Knepley , 8 Mar 2019 Cum, 16:41 tarihinde şunu
yazdı:

> On Fri, Mar 8, 2019 at 8:38 AM Eda Oktay  wrote:
>
>> Dear Matt,
>>
>> Thank you for your answer but I get an error even before compiling ex6.
>> The error is:
>>
>> error: too many arguments to function ‘DMSetField’
>>ierr = DMSetField(dm, 0, NULL, (PetscObject) fe);CHKERRQ(ierr);
>>
>
> You need PETSc master and slepc-dev.
>
>   Thanks,
>
>  Matt
>
>
>> Eda
>>
>>
>> Matthew Knepley , 7 Mar 2019 Per, 15:07 tarihinde
>> şunu yazdı:
>>
>>> On Thu, Mar 7, 2019 at 6:45 AM Eda Oktay via petsc-users <
>>> petsc-users@mcs.anl.gov> wrote:
>>>
>>>> Hello,
>>>>
>>>> I have a code finding Laplacian of a matrix and then I need to find
>>>> this Laplacian's second smallest eigenpair. I used EPSGetEigenpair code but
>>>> I get the values like "0." or "4." (I could not get decimals) when I used
>>>> PetscPrintf(PETSC_COMM_WORLD," The second smallest eigenvalue: %g\n",kr)
>>>> line.
>>>>
>>>> What could be the problem?
>>>>
>>>
>>> Hi Eda,
>>>
>>> I have an example that does just this, and I am getting the correct
>>> result. I have not yet checked it in,
>>> but i attach it here. Are you setting the right target?
>>>
>>>   Thanks,
>>>
>>> Matt
>>>
>>>
>>>> Best regards,
>>>>
>>>> Eda
>>>>
>>>
>>>
>>> --
>>> 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
>>>
>>> https://www.cse.buffalo.edu/~knepley/
>>> <http://www.cse.buffalo.edu/~knepley/>
>>>
>>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>


Re: [petsc-users] EPSGetEigenpair Problem

2019-03-08 Thread Eda Oktay via petsc-users
Dear Matt,

Thank you for your answer but I get an error even before compiling ex6. The
error is:

error: too many arguments to function ‘DMSetField’
   ierr = DMSetField(dm, 0, NULL, (PetscObject) fe);CHKERRQ(ierr);

Eda


Matthew Knepley , 7 Mar 2019 Per, 15:07 tarihinde şunu
yazdı:

> On Thu, Mar 7, 2019 at 6:45 AM Eda Oktay via petsc-users <
> petsc-users@mcs.anl.gov> wrote:
>
>> Hello,
>>
>> I have a code finding Laplacian of a matrix and then I need to find this
>> Laplacian's second smallest eigenpair. I used EPSGetEigenpair code but I
>> get the values like "0." or "4." (I could not get decimals) when I used
>> PetscPrintf(PETSC_COMM_WORLD," The second smallest eigenvalue: %g\n",kr)
>> line.
>>
>> What could be the problem?
>>
>
> Hi Eda,
>
> I have an example that does just this, and I am getting the correct
> result. I have not yet checked it in,
> but i attach it here. Are you setting the right target?
>
>   Thanks,
>
> Matt
>
>
>> Best regards,
>>
>> Eda
>>
>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>


[petsc-users] EPSGetEigenpair Problem

2019-03-07 Thread Eda Oktay via petsc-users
Hello,

I have a code finding Laplacian of a matrix and then I need to find this
Laplacian's second smallest eigenpair. I used EPSGetEigenpair code but I
get the values like "0." or "4." (I could not get decimals) when I used
PetscPrintf(PETSC_COMM_WORLD," The second smallest eigenvalue: %g\n",kr)
line.

What could be the problem?

Best regards,

Eda


Re: [petsc-users] Problem in loading Matrix Market format

2019-02-28 Thread Eda Oktay via petsc-users
Dear Professor Roman,

Thank you for your answer. I used PetscBinaryWrite.m file and converted
matrices into binary format but I have a question:

When I look at Properties of the binary files Petsc have, their type is
stated as "Program (application/octet-stream)", however when I checked the
binary files I created their type is stated as "Binary
(application/octet-stream)". Can this cause a problem, why they are
different?

Eda

Jose E. Roman , 12 Şub 2019 Sal, 12:05 tarihinde şunu
yazdı:

> It is better to convert the matrices to PETSc binary format first. One
> easy way is to read them into Matlab with mmread.m and write with PETSc's
> PetscBinaryWrite.m. This can be done similarly in python.
> Jose
>
>
> > El 12 feb 2019, a las 8:50, Eda Oktay via petsc-users <
> petsc-users@mcs.anl.gov> escribió:
> >
> > Hello,
> >
> > I am trying to load matrix in Matrix Market format. I found an example
> on mat file  (ex78) whih can be tested by using .dat file. Since .dat file
> and .mtx file are similar  in structure (specially afiro_A.dat file is
> similar to amesos2_test_mat0.mtx since they both have 3 columns and the
> columns represent the same properties), I tried to run ex78 by using
> amesos2_test_mat0.mtx instead of afiro_A.dat. However, I got the error
> "Badly formatted input file". Here is the full error message:
> >
> > [0]PETSC ERROR: - Error Message
> --
> > [0]PETSC ERROR: Badly formatted input file
> >
> > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
> > [0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
> > [0]PETSC ERROR: ./ex78 on a arch-linux2-c-debug named
> 7330.wls.metu.edu.tr by edaoktay Tue Feb 12 10:47:58 2019
> > [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
> --with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
> --download-metis --download-parmetis --download-superlu_dist
> --download-slepc --download-mpich
> > [0]PETSC ERROR: #1 main() line 73 in
> /home/edaoktay/petsc-3.10.3/src/mat/examples/tests/ex78.c
> > [0]PETSC ERROR: PETSc Option Table entries:
> > [0]PETSC ERROR: -Ain
> /home/edaoktay/petsc-3.10.3/share/petsc/datafiles/matrices/amesos2_test_mat0.mtx
> > [0]PETSC ERROR: End of Error Message ---send entire
> error message to petsc-ma...@mcs.anl.gov--
> > application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0
> > [unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=1
> > :
> > system msg for write_line failure : Bad file descriptor
> >
> > I know there is also an example (ex72) for Matrix Market format but in
> description, it is only proper for symmmetric and lower triangle, so I
> decided to use ex78.
> >
> > Best regards,
> >
> > Eda
>
>


[petsc-users] Error in using MatTranspose

2019-02-28 Thread Eda Oktay via petsc-users
Hello,

I am trying to use MatTranspose function as in below (last row) but I get
an error like this:
[0]PETSC ERROR: - Error Message
--
[0]PETSC ERROR: Object is in wrong state
[0]PETSC ERROR: Not for unassembled matrix
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for
trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018
[0]PETSC ERROR: ./FINAL on a arch-linux2-c-debug named
localhost.localdomain by edaoktay Wed Feb 27 16:36:34 2019
[0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas
--download-metis --download-parmetis --download-superlu_dist
--download-slepc --download-mpich
[0]PETSC ERROR: #1 MatTranspose() line 4821 in
/home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c
[0]PETSC ERROR: #2 main() line 185 in
/home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/FINAL.c
[0]PETSC ERROR: PETSc Option Table entries:
[0]PETSC ERROR: -f
/home/edaoktay/petsc-3.10.3/share/petsc/datafiles/matrices/small
[0]PETSC ERROR: -unweighted
[0]PETSC ERROR: End of Error Message ---send entire
error message to petsc-ma...@mcs.anl.gov--

I understood that error states that there is an unassembled matrix but
there is not, as it can be seen below, I defined NSymmA and I want to get
NSymmAtr.

This not the first time I use MatTranspose but I only get this error here.
What can be the reason?

Best regards,

Eda


ierr = MatGetOwnershipRange(L,,);CHKERRQ(ierr);


ierr =
MatDuplicate(A,MAT_DO_NOT_COPY_VALUES,);CHKERRQ(ierr);
for(rw = mm; rw

Re: [petsc-users] Finding nonzero indices

2019-02-25 Thread Eda Oktay via petsc-users
Okay, but here is another silly question:

>From MatGetRow(), I get number of nonzeros in row, column indices and
values right? Also, PetscBinaryWrite() needs a buffer p and the number of
items to write n.

I need both row,column indices and values. So, what should I write into
PetscBinaryWrite? Does this for loop give me these 3 arrays (arrays consist
of row indices,column indices and values)?

Eda

Matthew Knepley , 25 Şub 2019 Pzt, 18:37 tarihinde şunu
yazdı:

> On Mon, Feb 25, 2019 at 10:20 AM Eda Oktay  wrote:
>
>> Thank you for your answer Matt, but I have some questions about
>>> PetscBinaryWrite() since I am a new user.
>>>
>>> Since I am going to use this function, I guess I have to open a new
>>> binary file with PetscViewerBinaryOpen
>>> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerBinaryOpen.html#PetscViewerBinaryOpen>
>>>  and  PetscViewerBinaryGetDescriptor
>>> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerBinaryGetDescriptor.html#PetscViewerBinaryGetDescriptor>,
>>> and destroy viewer by  PetscViewerDestroy
>>> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerDestroy.html#PetscViewerDestroy>.
>>> Do I write these functions into for loop or not?
>>>
>>
> No, they go outside.
>
>   Thanks,
>
> Matt
>
>
>> Eda
>>>
>>> Matthew Knepley , 25 Şub 2019 Pzt, 17:31 tarihinde
>>> şunu yazdı:
>>>
>>>> On Mon, Feb 25, 2019 at 5:25 AM Eda Oktay via petsc-users <
>>>> petsc-users@mcs.anl.gov> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I am trying to find the indices (both row and column separately) of
>>>>> nonzero entries of a sparse matrix in Petsc Binary Format. I found
>>>>> MatGetSeqNonzeroStructure but it gives me a struct and I don't know 
>>>>> whether
>>>>> this is what I want or not.
>>>>>
>>>>
>>>> I would not do it that way, since it is fragile. I would write a loop
>>>> like this:
>>>>
>>>> MAtGetOwnershipRange();
>>>> for (row = rStart; row < rEnd; ++row) {
>>>>   MatGetRow()
>>>>   PetscBinaryWrite()
>>>>   MatRestoreRow()
>>>> }
>>>>
>>>> This will work for any matrix.
>>>>
>>>> Matt
>>>>
>>>>
>>>>> Best regards,
>>>>>
>>>>> Eda
>>>>>
>>>>
>>>>
>>>> --
>>>> 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
>>>>
>>>> https://www.cse.buffalo.edu/~knepley/
>>>> <http://www.cse.buffalo.edu/~knepley/>
>>>>
>>>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>


Re: [petsc-users] Finding nonzero indices

2019-02-25 Thread Eda Oktay via petsc-users
>
> Thank you for your answer Matt, but I have some questions about
> PetscBinaryWrite() since I am a new user.
>
> Since I am going to use this function, I guess I have to open a new binary
> file with PetscViewerBinaryOpen
> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerBinaryOpen.html#PetscViewerBinaryOpen>
>  and  PetscViewerBinaryGetDescriptor
> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerBinaryGetDescriptor.html#PetscViewerBinaryGetDescriptor>,
> and destroy viewer by  PetscViewerDestroy
> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerDestroy.html#PetscViewerDestroy>.
> Do I write these functions into for loop or not?
>
> Eda
>
> Matthew Knepley , 25 Şub 2019 Pzt, 17:31 tarihinde
> şunu yazdı:
>
>> On Mon, Feb 25, 2019 at 5:25 AM Eda Oktay via petsc-users <
>> petsc-users@mcs.anl.gov> wrote:
>>
>>> Hello,
>>>
>>> I am trying to find the indices (both row and column separately) of
>>> nonzero entries of a sparse matrix in Petsc Binary Format. I found
>>> MatGetSeqNonzeroStructure but it gives me a struct and I don't know whether
>>> this is what I want or not.
>>>
>>
>> I would not do it that way, since it is fragile. I would write a loop
>> like this:
>>
>> MAtGetOwnershipRange();
>> for (row = rStart; row < rEnd; ++row) {
>>   MatGetRow()
>>   PetscBinaryWrite()
>>   MatRestoreRow()
>> }
>>
>> This will work for any matrix.
>>
>> Matt
>>
>>
>>> Best regards,
>>>
>>> Eda
>>>
>>
>>
>> --
>> 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
>>
>> https://www.cse.buffalo.edu/~knepley/
>> <http://www.cse.buffalo.edu/~knepley/>
>>
>


  1   2   >