Subversion Repositories programming

Rev

Rev 302 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 302 Rev 303
Line 1... Line 1...
1
/*******************************************************************************
1
/*******************************************************************************
2
 * proj1.c - implement a simple program that will find the minimum and maximum
2
 * proj1-sequential.c - implement a simple program that will find the minimum
3
 *           numbers out of a randomly generated list of integers, using MPI
3
 *                      and maximum numbers out of a randomly generated list
4
 *           to parallelize the operation.
4
 *                      of integers, using MPI to parallelize the operation.
5
 *
5
 *
6
 * Copyright (c) 2006, Ira W. Snyder (devel@irasnyder.com)
6
 * Copyright (c) 2006, Ira W. Snyder (devel@irasnyder.com)
7
 * All rights reserved.
7
 * All rights reserved.
8
 *
8
 *
9
 * Permission is hereby granted, free of charge, to any person obtaining a copy
9
 * Permission is hereby granted, free of charge, to any person obtaining a copy
Line 27... Line 27...
27
 
27
 
28
#include <stdio.h>
28
#include <stdio.h>
29
#include <stdlib.h>
29
#include <stdlib.h>
30
#include <limits.h>
30
#include <limits.h>
31
#include <unistd.h>
31
#include <unistd.h>
32
//#include <mpi.h>
-
 
33
 
32
 
34
int main (int argc, char *argv[])
33
int main (int argc, char *argv[])
35
{
34
{
36
    int i;
35
    int i;
37
    int c = -1;
36
    int c = -1;
Line 94... Line 93...
94
    for (i=0; i<n; i++)
93
    for (i=0; i<n; i++)
95
    {
94
    {
96
        /* max */
95
        /* max */
97
        if (numbers[i] > max)
96
        if (numbers[i] > max)
98
            max = numbers[i];
97
            max = numbers[i];
99
        
98
 
100
        if (numbers[i] < min)
99
        if (numbers[i] < min)
101
            min = numbers[i];
100
            min = numbers[i];
102
    }
101
    }
103
 
102
 
104
    /* Print the results */
103
    /* Print the results */