Skip to content

Commit 90342e7

Browse files
committed
try to make serial compile faster
1 parent 3ea3f98 commit 90342e7

2 files changed

Lines changed: 44 additions & 42 deletions

File tree

Common/include/parallelization/mpi_structure.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,49 @@ void CBaseMPIWrapper::Error(std::string ErrorMsg, std::string FunctionName){
122122
}
123123
Abort(currentComm, 0);
124124
}
125+
126+
void CBaseMPIWrapper::CopyData(const void* sendbuf, void* recvbuf, int size, Datatype datatype) {
127+
switch (datatype) {
128+
case MPI_DOUBLE:
129+
for (int i = 0; i < size; i++) {
130+
static_cast<su2double*>(recvbuf)[i] = static_cast<const su2double*>(sendbuf)[i];
131+
}
132+
break;
133+
case MPI_UNSIGNED_LONG:
134+
for (int i = 0; i < size; i++) {
135+
static_cast<unsigned long*>(recvbuf)[i] = static_cast<const unsigned long*>(sendbuf)[i];
136+
}
137+
break;
138+
case MPI_LONG:
139+
for (int i = 0; i < size; i++) {
140+
static_cast<long*>(recvbuf)[i] = static_cast<const long*>(sendbuf)[i];
141+
}
142+
break;
143+
case MPI_UNSIGNED_SHORT:
144+
for (int i = 0; i < size; i++) {
145+
static_cast<unsigned short*>(recvbuf)[i] = static_cast<const unsigned short*>(sendbuf)[i];
146+
}
147+
break;
148+
case MPI_CHAR:
149+
for (int i = 0; i < size; i++) {
150+
static_cast<char*>(recvbuf)[i] = static_cast<const char*>(sendbuf)[i];
151+
}
152+
break;
153+
case MPI_SHORT:
154+
for (int i = 0; i < size; i++) {
155+
static_cast<short*>(recvbuf)[i] = static_cast<const short*>(sendbuf)[i];
156+
}
157+
break;
158+
case MPI_INT:
159+
for (int i = 0; i < size; i++) {
160+
static_cast<int*>(recvbuf)[i] = static_cast<const int*>(sendbuf)[i];
161+
}
162+
break;
163+
default:
164+
Error("Unknown type", CURRENT_FUNCTION);
165+
break;
166+
};
167+
}
125168
#endif
126169

127170
#ifdef HAVE_MPI

Common/include/parallelization/mpi_structure.hpp

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -503,48 +503,7 @@ class CBaseMPIWrapper {
503503
static int Rank, Size;
504504
static Comm currentComm;
505505

506-
static inline void CopyData(const void* sendbuf, void* recvbuf, int size, Datatype datatype) {
507-
switch (datatype) {
508-
case MPI_DOUBLE:
509-
for (int i = 0; i < size; i++) {
510-
static_cast<su2double*>(recvbuf)[i] = static_cast<const su2double*>(sendbuf)[i];
511-
}
512-
break;
513-
case MPI_UNSIGNED_LONG:
514-
for (int i = 0; i < size; i++) {
515-
static_cast<unsigned long*>(recvbuf)[i] = static_cast<const unsigned long*>(sendbuf)[i];
516-
}
517-
break;
518-
case MPI_LONG:
519-
for (int i = 0; i < size; i++) {
520-
static_cast<long*>(recvbuf)[i] = static_cast<const long*>(sendbuf)[i];
521-
}
522-
break;
523-
case MPI_UNSIGNED_SHORT:
524-
for (int i = 0; i < size; i++) {
525-
static_cast<unsigned short*>(recvbuf)[i] = static_cast<const unsigned short*>(sendbuf)[i];
526-
}
527-
break;
528-
case MPI_CHAR:
529-
for (int i = 0; i < size; i++) {
530-
static_cast<char*>(recvbuf)[i] = static_cast<const char*>(sendbuf)[i];
531-
}
532-
break;
533-
case MPI_SHORT:
534-
for (int i = 0; i < size; i++) {
535-
static_cast<short*>(recvbuf)[i] = static_cast<const short*>(sendbuf)[i];
536-
}
537-
break;
538-
case MPI_INT:
539-
for (int i = 0; i < size; i++) {
540-
static_cast<int*>(recvbuf)[i] = static_cast<const int*>(sendbuf)[i];
541-
}
542-
break;
543-
default:
544-
Error("Unknown type", CURRENT_FUNCTION);
545-
break;
546-
};
547-
}
506+
static void CopyData(const void* sendbuf, void* recvbuf, int size, Datatype datatype);
548507

549508
public:
550509
static void Error(std::string ErrorMsg, std::string FunctionName);

0 commit comments

Comments
 (0)