-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmystruct_opt.h
56 lines (43 loc) · 1.16 KB
/
mystruct_opt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* @file mystruct_opt.h
* @author Patrick Flick <[email protected]>
*
* Copyright (c) 2016 Georgia Institute of Technology. All Rights Reserved.
*/
#ifndef MYSTRUCT_H
#define MYSTRUCT_H
#include <mpi.h>
#include <iostream>
/*
* TODO: Investigate how you can change this structure to increase MPI
* performance within radix sort.
*/
struct MyStruct {
unsigned int key;
double d;
char e[4];
};
/**
* Returns the MPI_Datatype for `MyStruct`.
*
* TODO: You have to implement this function in mystruct_opt.cpp
*/
MPI_Datatype mystruct_get_mpi_type();
/**
* Returns a random instance of `MyStruct`.
*/
MyStruct mystruct_rand();
/**
* Returns the value of the key of `MyStruct`.
*/
unsigned int mystruct_key_access(const MyStruct& s);
/**
* Further utility functions that you don't have to worry about.
*/
// operator used for comparison based sorting
bool operator<(const MyStruct& lhs, const MyStruct& rhs);
// operator for comparing if two MyStruct's are equal
bool operator==(const MyStruct& lhs, const MyStruct& rhs);
// output format for MyStruct
std::ostream& operator <<(std::ostream& stream, const MyStruct& s);
#endif