Skip to content

Commit

Permalink
Bugfix Parallel version
Browse files Browse the repository at this point in the history
  • Loading branch information
AWehrhahn committed Jul 22, 2021
1 parent 5d1975d commit 6f7af4f
Show file tree
Hide file tree
Showing 9 changed files with 218 additions and 139 deletions.
12 changes: 8 additions & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ CXXLD = $(F77)
lib_LTLIBRARIES = libsme.la
libsme_la_SOURCES = \
src/sme/platform.h \
src/sme/sme_synth_faster.h \
src/sme/sme_synth_faster.cpp \
src/sme/sme_python_bridge.h \
src/sme/sme_python_bridge.cpp \
src/sme/sme_synth_parallel.h \
src/sme/sme_synth_parallel.cpp \
src/sme/sme_idl_interface.h \
src/sme/sme_idl_interface.cpp \
src/sme/sme_cython_interface.h \
src/sme/sme_cython_interface.cpp \
src/sme/sme_parallel_interface.h \
src/sme/sme_parallel_interface.cpp \
src/eos/eos.f \
src/eos/eos_eqns.f \
src/eos/eos_math_special.f \
Expand Down
6 changes: 4 additions & 2 deletions Makefile_parallel.am → Makefile_sequential.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ CXXLD = $(F77)
lib_LTLIBRARIES = libsme.la
libsme_la_SOURCES = \
src/sme/platform.h \
src/sme/sme_synth_parallel.h \
src/sme/sme_synth_parallel.cpp \
src/sme/sme_synth_faster.h \
src/sme/sme_synth_faster.cpp \
src/sme/sme_python_bridge.h \
src/sme/sme_python_bridge.cpp \
src/eos/eos.f \
src/eos/eos_eqns.f \
src/eos/eos_math_special.f \
Expand Down
1 change: 1 addition & 0 deletions src/sme/sme_paralel_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ typedef struct
#define MUSIZE 77 // Maximum Number of mu angles
#define MAX_PATHLEN 512
#define MAX_OUT_LEN 511
#define SP_LEN 8

extern "C" typedef struct
{
Expand Down
13 changes: 7 additions & 6 deletions src/sme/sme_parallel_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ extern "C" const char *Parallel_FreeState(short clean_pointers, GlobalState *sta
}
extern "C" GlobalState *Parallel_CopyState(short clean_pointers, GlobalState *state)
{
printf("LINELIST Flag: %i\n", state->flagLINELIST);
return _CopyState(clean_pointers, state);
}

Expand Down Expand Up @@ -115,18 +116,18 @@ extern "C" char const *SME_DLL Parallel_InputLineList(int n, void *arg[], Global
int nlines = *(int *)arg[0];
IDL_STRING *a0 = (IDL_STRING *)arg[1];
double *linelist = (double *)arg[2];
char *species = (char *)calloc(slen * nlines, sizeof(char));
char species[slen * nlines]; // = (char *)calloc(slen * nlines, sizeof(char));

for (int i = 0; i < nlines; i++)
{
memcpy(species + slen * i, a0[i].s, a0[i].slen);
strncpy(&(species[slen * i]), a0[i].s, min(a0[i].slen, 8));
if (a0[i].slen < slen)
for (int l = a0[i].slen; l < slen; l++)
species[slen * i + l] = ' ';
}
const char *response = _InputLineList(nlines, slen, species, linelist, state);

free(species);
// free(species);

return response;
}
Expand Down Expand Up @@ -178,19 +179,19 @@ extern "C" char const *SME_DLL Parallel_UpdateLineList(int n, void *arg[], Globa
short *index = (short *)arg[3];

int slen = 8;
char *species = (char *)calloc(slen * nupdate, sizeof(char));
char species[slen * nupdate]; // = (char *)calloc(slen * nupdate, sizeof(char));

for (int i = 0; i < nupdate; i++)
{
memcpy(species + slen * i, a0[i].s, a0[i].slen);
strncpy(&(species[slen * i]), a0[i].s, a0[i].slen);
if (a0[i].slen < slen)
for (int l = a0[i].slen; l < slen; l++)
species[slen * i + l] = ' ';
}

const char *response = _UpdateLineList(nupdate, slen, index, species, a1, state);

free(species);
// free(species);

return response;
}
Expand Down
Loading

0 comments on commit 6f7af4f

Please sign in to comment.