Exemplo n.º 1
0
void compute_set(in_set_fn_t in_set_fn, int **image,
                            const float xmin,
                            const float xmax,
                            const float ymin,
                            const float ymax,
                            const int grid_size_x,
                            const int grid_size_y,
                            const int max_iter, MPI_Comm comm)
{
    int slice;
    int nslice;
    int **image_slice;
    int rank, size;

    MPI_Comm_rank(comm, &rank);
    MPI_Comm_size(comm, &size);

    /* Arbitrary number of slices */
    nslice = size;
    slice = rank;
    //for (slice = 0; slice < nslice; slice++ ) {
        image_slice = compute_slice(in_set_fn, slice, nslice, xmin, xmax,
                                               ymin, ymax,
                                               grid_size_x, grid_size_y,
                                               max_iter, comm);
        copy_slice_to_image(image_slice, image, slice, nslice,
                            grid_size_x, grid_size_y, comm);
        free(image_slice);
    //}
}
Exemplo n.º 2
0
static PyObject *
range_subscript(rangeobject* self, PyObject* item)
{
    if (PyIndex_Check(item)) {
        PyObject *i, *result;
        i = PyNumber_Index(item);
        if (!i)
            return NULL;
        result = compute_range_item(self, i);
        Py_DECREF(i);
        return result;
    }
    if (PySlice_Check(item)) {
        return compute_slice(self, item);
    }
    PyErr_Format(PyExc_TypeError,
                 "range indices must be integers or slices, not %.200s",
                 item->ob_type->tp_name);
    return NULL;
}