void mppa_barrier_wait(barrier_t *barrier) { int status; long long dummy; if(barrier->mode == BARRIER_MASTER) { dummy = -1; long long match; status = mppa_read(barrier->sync_fd_master, &match, sizeof(match)); assert(status == sizeof(match)); status = mppa_write(barrier->sync_fd_slave, &dummy, sizeof(long long)); assert(status == sizeof(long long)); } else { dummy = 0; long long mask; mask = 0; mask |= 1 << __k1_get_cluster_id(); status = mppa_write(barrier->sync_fd_master, &mask, sizeof(mask)); assert(status == sizeof(mask)); status = mppa_read(barrier->sync_fd_slave, &dummy, sizeof(long long)); assert(status == sizeof(long long)); } }
/* * Synchronizes status. */ static void sync_status(void) { ssize_t n; ssize_t count; n = NUM_THREADS*sizeof(int); count = mppa_write(outfd, &has_changed[rank*NUM_THREADS], n); assert(n == count); count = mppa_write(outfd, &too_far[rank*NUM_THREADS], n); assert(n == count); n = nprocs*NUM_THREADS*sizeof(int); count = mppa_read(infd, has_changed, n); assert(n == count); count = mppa_read(infd, too_far, n); assert(n == count); }
/* * Synchronizes with master process. */ void sync_master(void) { uint64_t mask; /* Synchronize with master. */ mask = 1 << rank; assert(mppa_write(sync_fd, &mask, 8) == 8); }
/* * Synchronizes centroids. */ static void sync_centroids(void) { ssize_t n; /* Bytes to send/receive. */ ssize_t count; /* Bytes actually sent/received. */ n = lncentroids[rank]*dimension*sizeof(float); count = mppa_write(outfd, lcentroids, n); assert(n == count); n = ncentroids*dimension*sizeof(float); count = mppa_read(infd, centroids, n); assert(n == count); }
/* * Synchronizes partial population. */ static void sync_ppopulation(void) { ssize_t n; /* Bytes to send/receive. */ ssize_t count; /* Bytes actually sent/received. */ /* Send partial population. */ n = ncentroids*sizeof(int); count = mppa_write(outfd, ppopulation, n); assert(n == count); /* Receive partial population. */ n = nprocs*lncentroids[rank]*sizeof(int); count = mppa_read(infd, ppopulation, n); assert(n == count); }
void mppa_write_rqueue (rqueue_t *rqueue, void *buffer, int buffer_size) { int status; status = mppa_write(rqueue->file_descriptor, buffer, buffer_size); assert(status == buffer_size); }
void mppa_write_channel (channel_t *channel, void *buffer, int buffer_size) { int status= mppa_write(channel->file_descriptor, buffer, buffer_size); assert(status == buffer_size); }