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 

Reply via email to