Skip to content

Instantly share code, notes, and snippets.

using Distributed
using DelimitedFiles
@everywhere using StaticArrays
@everywhere using SharedArrays
import Base.+
@everywhere const POINT_SIZE = 100
# Type alias for Point type
@everywhere const Point = SVector{POINT_SIZE, Float64}
use Random;
use Time;
use BlockDist;
use CyclicDist;
use ReplicatedDist;
use CommDiagnostics;
/* Config variables */
config const filename = "../data/test_10_10_2.chpl.txt";
config const outFilename = "out.txt";
use Random;
use Time;
use BlockDist;
/* Config variables */
config const filename = "../data/test_10_10_2.chpl.txt";
config const outFilename = "out.txt";
config const k = 2;
config const maxIter = 10;
config const numPoints = 10;
This file has been truncated, but you can view the full file.
-1.944786E+00 6.632243E-01 4.257525E+00 3.962638E+00 -3.932600E+00 -7.321502E+00 6.160875E+00 -1.323485E+00 3.246579E+00 3.009739E+00 -6.860724E+00 1.488020E+00 -8.004472E-01 6.202751E+00 7.856450E+00 -9.360562E+00 -5.299064E+00 2.634670E+00 3.862311E+00 9.524824E+00 -8.356478E+00 8.375440E+00 -5.614495E+00 7.579148E+00 -8.531261E+00 -6.766134E+00 2.264816E+00 -8.569965E+00 1.038255E+01 -1.016604E+01 8.457803E+00 -4.318040E+00 -6.251514E+00 -1.822312E+00 5.848543E+00 -7.344308E+00 -4.518476E-01 -2.241855E+00 4.954034E+00 6.886350E+00 3.231385E-01 5.733796E+00 9.962291E+00 2.830534E+00 -2.838126E+00 4.691835E+00 5.658994E+00 4.682257E+00 -1.258436E+00 -3.790162E+00 9.899833E+00 -9.852320E+00 -1.013742E+01 -2.848944E+00 -6.037991E-01 -8.650248E+00 -1.669262E-01 1.039300E+01 -2.281757E+00 5.067350E+00 -6.569396E+00 -1.014378E+00 -2.853350E+00 3.065784E+00 4.797558E+00 -5.598351E+00 -4.362062E+00 -1.029823E+01 1.097450E+01 7.536545E+00 -1.290761E+00 3.839679E+00 3.744734E+00 2.708245E+00 -2.690391E+00 -8.649821E+
using DelimitedFiles
using StaticArrays
import Base.+
const POINT_SIZE = 100
# Type alias for Point type
const Point = SVector{POINT_SIZE, Float64}
# Datatypes
using DelimitedFiles
using StaticArrays
const POINT_SIZE = 100
# Type alias for Point type
const Point = SVector{POINT_SIZE, Float64}
# Datatypes
mutable struct Cluster
size::Int64
This file has been truncated, but you can view the full file.
1.184894E+04 5.654326E+04 5.907482E+05 -9.846318E+02 -2.163987E+03 8.007838E+02 8.613457E+19
4.982234E+04 4.927830E+05 -2.350271E+05 -1.549084E+02 -2.905466E+03 -1.378157E+03 6.630254E+20
-6.140187E+04 3.148604E+05 1.192126E+04 -2.298229E+03 1.446356E+03 -1.952097E+02 1.461500E+20
-3.712425E+05 4.299456E+05 -2.676301E+05 1.842154E+03 -2.505566E+03 1.558639E+03 7.460969E+20
1.678310E+05 -5.357696E+05 -1.940057E+05 1.391965E+03 -7.285908E+02 -2.301435E+03 8.141498E+20
-3.143823E+05 -2.902738E+04 5.492425E+05 1.674761E+03 -1.759690E+03 2.537564E+03 3.805597E+20
4.244213E+04 4.411015E+05 1.306613E+05 2.277845E+03 -1.964589E+03 -1.876921E+03 8.725240E+20
-5.679920E+03 5.688436E+05 3.643281E+05 -1.487858E+03 -2.505441E+02 1.884941E+03 1.675821E+20
5.821950E+05 4.850269E+05 -1.505871E+05 -2.506206E+03 -7.524069E+02 2.988431E+02 3.416489E+20
-9.790402E+04 -1.859293E+05 -3.621173E+05 6.451201E+02 -2.693957E+03 -2.489746E+03 8.491267E+20
This file has been truncated, but you can view the full file.
1.184894E+04 5.654326E+04 5.907482E+05 -9.846318E+02 -2.163987E+03 8.007838E+02 8.613457E+19
4.982234E+04 4.927830E+05 -2.350271E+05 -1.549084E+02 -2.905466E+03 -1.378157E+03 6.630254E+20
-6.140187E+04 3.148604E+05 1.192126E+04 -2.298229E+03 1.446356E+03 -1.952097E+02 1.461500E+20
-3.712425E+05 4.299456E+05 -2.676301E+05 1.842154E+03 -2.505566E+03 1.558639E+03 7.460969E+20
1.678310E+05 -5.357696E+05 -1.940057E+05 1.391965E+03 -7.285908E+02 -2.301435E+03 8.141498E+20
-3.143823E+05 -2.902738E+04 5.492425E+05 1.674761E+03 -1.759690E+03 2.537564E+03 3.805597E+20
4.244213E+04 4.411015E+05 1.306613E+05 2.277845E+03 -1.964589E+03 -1.876921E+03 8.725240E+20
-5.679920E+03 5.688436E+05 3.643281E+05 -1.487858E+03 -2.505441E+02 1.884941E+03 1.675821E+20
5.821950E+05 4.850269E+05 -1.505871E+05 -2.506206E+03 -7.524069E+02 2.988431E+02 3.416489E+20
-9.790402E+04 -1.859293E+05 -3.621173E+05 6.451201E+02 -2.693957E+03 -2.489746E+03 8.491267E+20
config const filename = "../data/input.txt";
config const out_filename = "out.txt";
config const iterations = 1;
config const k = 2;
var f = open(filename, iomode.r);
var reader = f.reader();
const rows = reader.read(int);
const cols = reader.read(int);
use CyclicDist;
use Time;
config const filename = "input.txt";
config const iterations = 1;
config const out_filename = "out1.txt";
const X = 1;
const Y = 2;
const Z = 3;
const G = 6.67e-11;