Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
cc4s
Cyclops Tensor Framework
Commits
993b5138
Commit
993b5138
authored
11 years ago
by
solomon
Browse files
Options
Download
Email Patches
Plain Diff
split out pmpi interface to include timer from offload and not need mpi
parent
ef0b0a3b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
116 additions
and
73 deletions
+116
-73
src/shared/offload.cu
src/shared/offload.cu
+36
-1
src/shared/pmpi.h
src/shared/pmpi.h
+75
-0
src/shared/timer.h
src/shared/timer.h
+4
-69
src/shared/util.h
src/shared/util.h
+1
-3
No files found.
src/shared/offload.cu
View file @
993b5138
...
...
@@ -8,9 +8,44 @@
#include <stdio.h>
//#include "../shared/util.h"
#include "device_launch_parameters.h"
#include "
u
ti
l
.h"
#include "ti
mer
.h"
#include "offload.h"
#ifndef LIBT_ASSERT
#if ENABLE_ASSERT
#define LIBT_ASSERT(...) \
do { if (!(__VA_ARGS__)) handler(); assert(__VA_ARGS__); } while (0)
#else
#define LIBT_ASSERT(...) do {} while(0 && (__VA_ARGS__))
#endif
#endif
#define ABORT \
do{ \
assert(0); } while (0)
template
<
typename
dtype
>
dtype
get_zero
(){
ABORT
;
}
template
<
typename
dtype
>
dtype
get_one
(){
ABORT
;
}
template
<
>
inline
double
get_zero
<
double
>
()
{
return
0.0
;
}
template
<
>
inline
std
::
complex
<
double
>
get_zero
<
std
::
complex
<
double
>
>
()
{
return
std
::
complex
<
double
>
(
0.0
,
0.0
);
}
template
<
>
inline
double
get_one
<
double
>
()
{
return
1.0
;
}
template
<
>
inline
std
::
complex
<
double
>
get_one
<
std
::
complex
<
double
>
>
()
{
return
std
::
complex
<
double
>
(
1.0
,
0.0
);
}
int
initialized
=
0
;
cublasHandle_t
cuhandle
;
...
...
This diff is collapsed.
Click to expand it.
src/shared/pmpi.h
0 → 100644
View file @
993b5138
#ifndef __PMPI_H__
#define __PMPI_H__
#include "mpi.h"
void
CTF_set_context
(
MPI_Comm
ctxt
);
#ifdef PMPI
#define MPI_Bcast(...) \
{ CTF_Timer __t("MPI_Bcast"); \
__t.start(); \
PMPI_Bcast(__VA_ARGS__); \
__t.stop(); }
#define MPI_Reduce(...) \
{ CTF_Timer __t("MPI_Reduce"); \
__t.start(); \
PMPI_Reduce(__VA_ARGS__); \
__t.stop(); }
#define MPI_Wait(...) \
{ CTF_Timer __t("MPI_Wait"); \
__t.start(); \
PMPI_Wait(__VA_ARGS__); \
__t.stop(); }
#define MPI_Send(...) \
{ CTF_Timer __t("MPI_Send"); \
__t.start(); \
PMPI_Send(__VA_ARGS__); \
__t.stop(); }
#define MPI_Allreduce(...) \
{ CTF_Timer __t("MPI_Allreduce"); \
__t.start(); \
PMPI_Allreduce(__VA_ARGS__); \
__t.stop(); }
#define MPI_Allgather(...) \
{ CTF_Timer __t("MPI_Allgather"); \
__t.start(); \
PMPI_Allgather(__VA_ARGS__); \
__t.stop(); }
#define MPI_Scatter(...) \
{ CTF_Timer __t("MPI_Scatter"); \
__t.start(); \
PMPI_Scatter(__VA_ARGS__); \
__t.stop(); }
#define MPI_Alltoall(...) \
{ CTF_Timer __t("MPI_Alltoall"); \
__t.start(); \
PMPI_Alltoall(__VA_ARGS__); \
__t.stop(); }
#define MPI_Alltoallv(...) \
{ CTF_Timer __t("MPI_Alltoallv"); \
__t.start(); \
PMPI_Alltoallv(__VA_ARGS__); \
__t.stop(); }
#define MPI_Gatherv(...) \
{ CTF_Timer __t("MPI_Gatherv"); \
__t.start(); \
PMPI_Gatherv(__VA_ARGS__); \
__t.stop(); }
#define MPI_Scatterv(...) \
{ CTF_Timer __t("MPI_Scatterv"); \
__t.start(); \
PMPI_Scatterv(__VA_ARGS__); \
__t.stop(); }
#define MPI_Waitall(...) \
{ CTF_Timer __t("MPI_Waitall"); \
__t.start(); \
PMPI_Waitall(__VA_ARGS__); \
__t.stop(); }
#define MPI_Barrier(...) \
{ CTF_Timer __t("MPI_Barrier"); \
__t.start(); \
PMPI_Barrier(__VA_ARGS__); \
__t.stop(); }
#endif
#endif
This diff is collapsed.
Click to expand it.
src/shared/timer.h
View file @
993b5138
#ifndef __TIMER_H__
#define __TIMER_H__
#include "mpi.h"
#include "../../include/ctf.hpp"
void
CTF_set_main_args
(
int
argc
,
const
char
*
const
*
argv
);
void
CTF_set_context
(
MPI_Comm
ctxt
);
#ifdef PROFILE
#define TAU
#endif
#ifdef TAU
#define TAU_FSTART(ARG) \
...
...
@@ -32,73 +34,6 @@ void CTF_set_context(MPI_Comm ctxt);
else CTF_set_context((MPI_Comm)ARG);
#endif
#ifdef PMPI
#define MPI_Bcast(...) \
{ CTF_Timer __t("MPI_Bcast"); \
__t.start(); \
PMPI_Bcast(__VA_ARGS__); \
__t.stop(); }
#define MPI_Reduce(...) \
{ CTF_Timer __t("MPI_Reduce"); \
__t.start(); \
PMPI_Reduce(__VA_ARGS__); \
__t.stop(); }
#define MPI_Wait(...) \
{ CTF_Timer __t("MPI_Wait"); \
__t.start(); \
PMPI_Wait(__VA_ARGS__); \
__t.stop(); }
#define MPI_Send(...) \
{ CTF_Timer __t("MPI_Send"); \
__t.start(); \
PMPI_Send(__VA_ARGS__); \
__t.stop(); }
#define MPI_Allreduce(...) \
{ CTF_Timer __t("MPI_Allreduce"); \
__t.start(); \
PMPI_Allreduce(__VA_ARGS__); \
__t.stop(); }
#define MPI_Allgather(...) \
{ CTF_Timer __t("MPI_Allgather"); \
__t.start(); \
PMPI_Allgather(__VA_ARGS__); \
__t.stop(); }
#define MPI_Scatter(...) \
{ CTF_Timer __t("MPI_Scatter"); \
__t.start(); \
PMPI_Scatter(__VA_ARGS__); \
__t.stop(); }
#define MPI_Alltoall(...) \
{ CTF_Timer __t("MPI_Alltoall"); \
__t.start(); \
PMPI_Alltoall(__VA_ARGS__); \
__t.stop(); }
#define MPI_Alltoallv(...) \
{ CTF_Timer __t("MPI_Alltoallv"); \
__t.start(); \
PMPI_Alltoallv(__VA_ARGS__); \
__t.stop(); }
#define MPI_Gatherv(...) \
{ CTF_Timer __t("MPI_Gatherv"); \
__t.start(); \
PMPI_Gatherv(__VA_ARGS__); \
__t.stop(); }
#define MPI_Scatterv(...) \
{ CTF_Timer __t("MPI_Scatterv"); \
__t.start(); \
PMPI_Scatterv(__VA_ARGS__); \
__t.stop(); }
#define MPI_Waitall(...) \
{ CTF_Timer __t("MPI_Waitall"); \
__t.start(); \
PMPI_Waitall(__VA_ARGS__); \
__t.stop(); }
#define MPI_Barrier(...) \
{ CTF_Timer __t("MPI_Barrier"); \
__t.start(); \
PMPI_Barrier(__VA_ARGS__); \
__t.stop(); }
#endif
#endif
This diff is collapsed.
Click to expand it.
src/shared/util.h
View file @
993b5138
...
...
@@ -32,10 +32,8 @@ volatile static long_int long_int_max = INT64_MAX;
//#include <inttypes.h>
#endif
#ifdef PROFILE
#define TAU
#endif
#include "timer.h"
#include "pmpi.h"
#ifndef __APPLE__
#ifndef OMP_OFF
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment