Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equal distribution of particles to MPI processors #1231

Closed
wants to merge 5 commits into from

Commits on Aug 31, 2022

  1. Update collectionsoa.py

    Added some stuff
    JakeNewmanUEA authored Aug 31, 2022
    Configuration menu
    Copy the full SHA
    be039cb View commit details
    Browse the repository at this point in the history
  2. Equal distribution of particles to MPI processors

    When running simulations in MPI mode involving the repeated release of small quantities of particles (e.g. 100 particles across 10 MPI processors), we would occasionally receive the error 'Cannot initialise with fewer particles than MPI processors'. The cause of this appeared to be the way that K-means was distributing the particles among the MPI processors. Specifically, K-means does not return clusters of a fixed or minimum size, thus it is highly possible that some MPI processors will be allocated fewer than the minimum number of required particles, especially if the number of particles is small and the number of MPI processors approaches the maximum for a given number of particles (e.g. 10 MPI processors is the maximum for 100 particles, as 100 particles / 10 processors = 10 particles per processor). To overcome this, we equally distribute the available particles among the MPI processors using Numpy's linspace method. We create a linearly spaced array that is the same length as the number particles. The array contains decimals ranging from 0 to the number of MPI processors, and that array is then rounded down so that the values represent integer indices to MPI processors. As before, this change requires that the user has requested at least the minimum required number of MPI processors, but it ensures that the minimum number is always sufficient.
    JakeNewmanUEA authored Aug 31, 2022
    Configuration menu
    Copy the full SHA
    8b21bc9 View commit details
    Browse the repository at this point in the history
  3. Equal distribution of particles to MPI processors

    Related to pull request OceanParcels#1231. This change has only been tested for collectionsoa.py but not collectionaos.py.
    
    When running simulations in MPI mode involving the repeated release of small quantities of particles (e.g. 100 particles across 10 MPI processors), we would occasionally receive the error 'Cannot initialise with fewer particles than MPI processors'. The cause of this appeared to be the way that K-means was distributing the particles among the MPI processors. Specifically, K-means does not return clusters of a fixed or minimum size, thus it is highly possible that some MPI processors will be allocated fewer than the minimum number of required particles, especially if the number of particles is small and the number of MPI processors approaches the maximum for a given number of particles (e.g. 10 MPI processors is the maximum for 100 particles, as 100 particles / 10 processors = 10 particles per processor). To overcome this, we equally distribute the available particles among the MPI processors using Numpy's linspace method. We create a linearly spaced array that is the same length as the number particles. The array contains decimals ranging from 0 to the number of MPI processors, and that array is then rounded down so that the values represent integer indices to MPI processors. As before, this change requires that the user has requested at least the minimum required number of MPI processors, but it ensures that the minimum number is always sufficient.
    JakeNewmanUEA authored Aug 31, 2022
    Configuration menu
    Copy the full SHA
    e3b100d View commit details
    Browse the repository at this point in the history

Commits on Sep 1, 2022

  1. Equal distribution of particles to MPI processors

    Following pull request OceanParcels#1231: Reinstated K-Means as the method of grouping particle locations. Rather than using the clusters assignments directly, we find the X nearest coordinates to each cluster centroid, where X is the minimum number of particles required to distribute the particles equally among MPI processors. The result is an (approximately) equal number of particles assigned to each MPI processor, with particles being grouped according to their spatial distribution.
    JakeNewmanUEA authored Sep 1, 2022
    Configuration menu
    Copy the full SHA
    b44e59c View commit details
    Browse the repository at this point in the history
  2. Equal distribution of particles to MPI processors

    Following pull request OceanParcels#1231: Reinstated K-Means as the method of grouping particle locations. Rather than using the clusters assignments directly, we find the X nearest coordinates to each cluster centroid, where X is the minimum number of particles required to distribute the particles equally among MPI processors. The result is an (approximately) equal number of particles assigned to each MPI processor, with particles being grouped according to their spatial distribution.
    JakeNewmanUEA authored Sep 1, 2022
    Configuration menu
    Copy the full SHA
    11fdf50 View commit details
    Browse the repository at this point in the history