Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to read ints from a text file with MPI and C++
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COYou're going to have problems here because your lines aren't of all the same length; there are 8,9,10,11, and 12-character lines. So simply dividing the file size by the number of processors (or something) and reading it in is unlikely to work. You could use the same approach [as in this answer](http://stackoverflow.com/a/12942718/463827) to divide up the file, and as a post-processing step do any loadbalancing as necessary. But in general text files aren't great for parallel I/O.
      singulars
    2. COi'm creating that file from another one because i need it to be formatted like this (I'm reading the neighbors of a node in a graph with it) so i can modify it, but i don't know what kind of file to use so i can read it properly, should i make it binary ? what is the best file type to use in this situation ?
      singulars
    3. COI would either: (a) create it as a binary file; (b) preprocess it to split it up into the right number of sub files before running (eg, `split --lines=N top.txt` where N is the number of lines per processor) & have each processor read its own file; or, if the file isn't huge, (c) read it in with one processor and then distribute the data using `MPI_Scatter()` or `MPI_Scatterv()`. We could probably cobble something together that would use MPI-IO using the approach in the linked answer but unless there's some other compelling reason I'd tend to think it would be more trouble than it's worth.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload