Commit e56a1e5e authored by Florian Wittkamp's avatar Florian Wittkamp

CLEANUP: Removed checkpointing

Removed all checkpointing things in the code.
parent 5d09bb71
......@@ -120,7 +120,6 @@ DENISE= \
PML_pro.c \
readdsk.c \
read_par_json.c \
read_checkpoint.c\
readmod.c \
readmod_elastic.c \
readmod_acoustic.c \
......@@ -130,7 +129,6 @@ DENISE= \
apply_workflow.c \
saveseis.c \
saveseis_glob.c \
save_checkpoint.c\
sources.c \
solvelin.c \
spat_filt.c \
......
......@@ -919,20 +919,6 @@ int main(int argc, char **argv){
MPI_Barrier(MPI_COMM_WORLD);
if (CHECKPTREAD){
if (MYID==0){
time3=MPI_Wtime();
fprintf(FP," Reading wavefield from check-point file %s \n",CHECKPTFILE);
}
read_checkpoint(-1, NX+2, -1, NY+2, pvx, pvy, psxx, psyy, psxy);
MPI_Barrier(MPI_COMM_WORLD);
if (MYID==0){
time4=MPI_Wtime();
fprintf(FP," finished (real time: %4.2f s).\n",time4-time3);
}
}
/* comunication initialisation for persistent communication */
/*comm_ini(bufferlef_to_rig, bufferrig_to_lef, buffertop_to_bot, bufferbot_to_top, req_send, req_rec);*/
......@@ -1340,7 +1326,7 @@ int main(int argc, char **argv){
}
/* explosive source */
if ((!CHECKPTREAD)&&(QUELLTYP==1))
if ((QUELLTYP==1))
psource(nt,psxx,psyy,psp,srcpos_loc,signals,nsrc_loc,0);
if ((FREE_SURF) && (POS[2]==0)){
......@@ -1828,7 +1814,7 @@ int main(int argc, char **argv){
/* explosive source */
if ((!CHECKPTREAD)&&(QUELLTYP==1)&&(WAVETYPE==1||WAVETYPE==3))
if ((QUELLTYP==1)&&(WAVETYPE==1||WAVETYPE==3))
psource(nt,psxx,psyy,psp,srcpos_loc,signals,nsrc_loc,0);
/* apply free surface */
......@@ -2308,7 +2294,7 @@ int main(int argc, char **argv){
}
/* explosive source */
if ((!CHECKPTREAD)&&(QUELLTYPB==4))
if ((QUELLTYPB==4))
psource(nt,psxx,psyy,psp,srcpos_loc_back,sectionpdiff,ntr1,1);
if ((FREE_SURF) && (POS[2]==0)){
......@@ -3389,7 +3375,7 @@ int main(int argc, char **argv){
}
/* explosive source */
if ((!CHECKPTREAD)&&(QUELLTYP==1))
if ((QUELLTYP==1))
psource(nt,psxx,psyy,psp,srcpos_loc,signals,nsrc_loc,0);
if ((FREE_SURF) && (POS[2]==0)){
......@@ -3915,20 +3901,7 @@ int main(int argc, char **argv){
/*----------- End fullwaveform iteration loop ----------------------------------*/
/*------------------------------------------------------------------------------*/
/* Checkpointing to resume FWI */
if (CHECKPTWRITE){
if (MYID==0){
time3=MPI_Wtime();
fprintf(FP," Saving wavefield to check-point file %s \n",CHECKPTFILE);
}
save_checkpoint(-1, NX+2, -1, NY+2, pvx, pvy, psxx, psyy, psxy);
MPI_Barrier(MPI_COMM_WORLD);
if (MYID==0){
time4=MPI_Wtime();
fprintf(FP," finished (real time: %4.2f s).\n",time4-time3);
}
}
/* ====================================== */
/* ====== deallocation of memory =========*/
/* ====================================== */
......
......@@ -39,11 +39,11 @@ void exchange_par(void){
extern float TSNAP1, TSNAP2, TSNAPINC, REFREC[4];
extern char MFILE[STRING_SIZE], SIGNAL_FILE[STRING_SIZE],SIGNAL_FILE_SH[STRING_SIZE], LOG_FILE[STRING_SIZE];
extern char SNAP_FILE[STRING_SIZE], SOURCE_FILE[STRING_SIZE], REC_FILE[STRING_SIZE];
extern char SEIS_FILE_VX[STRING_SIZE], SEIS_FILE_VY[STRING_SIZE], CHECKPTFILE[STRING_SIZE];
extern char SEIS_FILE_VX[STRING_SIZE], SEIS_FILE_VY[STRING_SIZE];
extern char SEIS_FILE_CURL[STRING_SIZE], SEIS_FILE_DIV[STRING_SIZE], SEIS_FILE_P[STRING_SIZE];
extern char JACOBIAN[STRING_SIZE], DATA_DIR[STRING_SIZE], INV_MODELFILE[STRING_SIZE], FREQ_FILE[STRING_SIZE];
extern int RUN_MULTIPLE_SHOTS, TAPERLENGTH, INVTYPE;
extern int NPROC, NPROCX, NPROCY, MYID, IDX, IDY, CHECKPTREAD, CHECKPTWRITE;
extern int NPROC, NPROCX, NPROCY, MYID, IDX, IDY;
extern int GRADT1, GRADT2, GRADT3, GRADT4, ITERMAX, INVMAT1, INVMAT, QUELLTYPB;
extern int GRAD_METHOD;
extern float TSHIFT_back;
......@@ -228,8 +228,7 @@ void exchange_par(void){
idum[26] = NGEOPH;
idum[27] = NDT;
idum[28] = SEIS_FORMAT;
idum[29] = CHECKPTREAD;
idum[30] = CHECKPTWRITE;
idum[31] = FDORDER;
idum[32] = MAXRELERROR;
......@@ -365,7 +364,6 @@ void exchange_par(void){
MPI_Bcast(&LOG_FILE,STRING_SIZE,MPI_CHAR,0,MPI_COMM_WORLD);
MPI_Bcast(&SIGNAL_FILE,STRING_SIZE,MPI_CHAR,0,MPI_COMM_WORLD);
MPI_Bcast(&SIGNAL_FILE_SH,STRING_SIZE,MPI_CHAR,0,MPI_COMM_WORLD);
MPI_Bcast(&CHECKPTFILE,STRING_SIZE,MPI_CHAR,0,MPI_COMM_WORLD);
MPI_Bcast(&JACOBIAN,STRING_SIZE,MPI_CHAR,0,MPI_COMM_WORLD);
MPI_Bcast(&DATA_DIR,STRING_SIZE,MPI_CHAR,0,MPI_COMM_WORLD);
MPI_Bcast(&INV_MODELFILE,STRING_SIZE,MPI_CHAR,0,MPI_COMM_WORLD);
......@@ -492,8 +490,7 @@ void exchange_par(void){
NGEOPH = idum[26];
NDT = idum[27];
SEIS_FORMAT = idum[28];
CHECKPTREAD = idum[29];
CHECKPTWRITE = idum[30];
FDORDER = idum[31];
MAXRELERROR = idum[32];
......
......@@ -16,9 +16,9 @@ float REC_ARRAY_DEPTH, REC_ARRAY_DIST;
float REFREC[4]={0.0, 0.0, 0.0, 0.0}, FPML;
int SEISMO, NDT, NGEOPH, NSRC=1, SEIS_FORMAT, FREE_SURF, READMOD, READREC, SRCREC, FW=0;
int NX, NY, NT, QUELLART,QUELLART_SH, QUELLTYP, SNAP, SNAP_FORMAT, REC_ARRAY, RUN_MULTIPLE_SHOTS, NTRG;
int L, BOUNDARY, DC, DRX, NXG, NYG, IDX, IDY, CHECKPTREAD, CHECKPTWRITE, FDORDER, MAXRELERROR;
int L, BOUNDARY, DC, DRX, NXG, NYG, IDX, IDY, FDORDER, MAXRELERROR;
char SNAP_FILE[STRING_SIZE], SOURCE_FILE[STRING_SIZE], SIGNAL_FILE[STRING_SIZE], SIGNAL_FILE_SH[STRING_SIZE];
char MFILE[STRING_SIZE], REC_FILE[STRING_SIZE], CHECKPTFILE[STRING_SIZE];
char MFILE[STRING_SIZE], REC_FILE[STRING_SIZE];
char SEIS_FILE_VX[STRING_SIZE], SEIS_FILE_VY[STRING_SIZE], SEIS_FILE_VZ[STRING_SIZE], LOG_FILE[STRING_SIZE];
char SEIS_FILE_CURL[STRING_SIZE], SEIS_FILE_DIV[STRING_SIZE], SEIS_FILE_P[STRING_SIZE];
FILE *FP;
......
/*-----------------------------------------------------------------------------------------
* Copyright (C) 2013 For the list of authors, see file AUTHORS.
*
* This file is part of DENISE.
*
* DENISE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2.0 of the License only.
*
* DENISE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DENISE. See file COPYING and/or <http://www.gnu.org/licenses/gpl-2.0.html>.
-----------------------------------------------------------------------------------------*/
#include "fd.h"
void read_checkpoint(int nx1, int nx2, int ny1, int ny2,
float ** vx, float ** vy, float ** sxx, float ** syy, float ** sxy){
int i,j;
char myid[5];
FILE *fp;
char checkptfile[STRING_SIZE];
extern int MYID;
extern char CHECKPTFILE[STRING_SIZE];
sprintf(checkptfile,"%s",CHECKPTFILE);
sprintf(myid,".%d",MYID);
strcat(checkptfile,myid);
fp=fopen(checkptfile,"rb");
if (fp==NULL) err("CHECKPTFILE can't be opened !");
for (j=ny1;j<=ny2;j++){
for (i=nx1;i<=nx2;i++){
fread( &vx[j][i],sizeof(float),1,fp);
fread( &vy[j][i],sizeof(float),1,fp);
fread(&sxx[j][i],sizeof(float),1,fp);
fread(&syy[j][i],sizeof(float),1,fp);
fread(&sxy[j][i],sizeof(float),1,fp);
}
}
fclose(fp);
}
......@@ -38,10 +38,10 @@ void read_par_json(FILE *fp, char *fileinp){
extern int SNAPSHOT_START,SNAPSHOT_END,SNAPSHOT_INCR;
extern char MFILE[STRING_SIZE], SIGNAL_FILE[STRING_SIZE], SIGNAL_FILE_SH[STRING_SIZE], LOG_FILE[STRING_SIZE];
extern char SNAP_FILE[STRING_SIZE], SOURCE_FILE[STRING_SIZE], REC_FILE[STRING_SIZE];
extern char SEIS_FILE_VX[STRING_SIZE], SEIS_FILE_VY[STRING_SIZE], SEIS_FILE_VZ[STRING_SIZE], CHECKPTFILE[STRING_SIZE];
extern char SEIS_FILE_VX[STRING_SIZE], SEIS_FILE_VY[STRING_SIZE], SEIS_FILE_VZ[STRING_SIZE];
extern char SEIS_FILE_CURL[STRING_SIZE], SEIS_FILE_DIV[STRING_SIZE], SEIS_FILE_P[STRING_SIZE];
extern char JACOBIAN[STRING_SIZE],DATA_DIR[STRING_SIZE],FREQ_FILE[STRING_SIZE];
extern int NPROCX, NPROCY, MYID, IDX, IDY, CHECKPTREAD, CHECKPTWRITE;
extern int NPROCX, NPROCY, MYID, IDX, IDY;
extern int GRADT1, GRADT2, GRADT3, GRADT4, ITERMAX, INVMAT1, INVMAT, QUELLTYPB;
extern int GRAD_METHOD;
extern float TSHIFT_back;
......@@ -368,16 +368,6 @@ void read_par_json(FILE *fp, char *fileinp){
}
if (get_string_from_objectlist("MFILE",number_readobjects,MFILE,varname_list, value_list))
err("Variable MFILE could not be retrieved from the json input file!");
if (get_int_from_objectlist("CHECKPTREAD",number_readobjects,&CHECKPTREAD,varname_list, value_list)){
CHECKPTREAD=0;
fprintf(fp,"Variable CHECKPTREAD is set to default value %d.\n",CHECKPTREAD);}
if (get_int_from_objectlist("CHECKPTWRITE",number_readobjects,&CHECKPTWRITE,varname_list, value_list)){
CHECKPTWRITE=0;
fprintf(fp,"Variable CHECKPTWRITE is set to default value %d.\n",CHECKPTWRITE);}
if (get_string_from_objectlist("LOG_FILE",number_readobjects,LOG_FILE,varname_list, value_list)){
sprintf(LOG_FILE,"log/LOG_FILE");}
if (get_string_from_objectlist("CHECKPTFILE",number_readobjects,CHECKPTFILE,varname_list, value_list)){
sprintf(CHECKPTFILE,"tmp/checkpoint_fdveps");}
if (get_int_from_objectlist("READMOD",number_readobjects,&READMOD,varname_list, value_list))
err("Variable READMOD could not be retrieved from the json input file!");
......@@ -983,28 +973,6 @@ void read_par_json(FILE *fp, char *fileinp){
}
}
/* checkpoint file */
if (CHECKPTREAD || CHECKPTWRITE)
{
if (access(CHECKPTFILE,0) != 0)
{
fprintf(fp, "\n==================================================================\n");
fprintf(fp, " ERROR parsing input file <%s>:\n", fileinp);
fprintf(fp, " The checkpoint file does not exist!\n");
fprintf(fp, " File name: <%s>", CHECKPTFILE);
fprintf(fp, "\n==================================================================\n");
fserr = 1;
}
else if (access(CHECKPTFILE,6) != 0)
{
fprintf(fp, "\n==================================================================\n");
fprintf(fp, " ERROR parsing input file <%s>:\n", fileinp);
fprintf(fp, " The checkpoint file does not have read and/or write access!\n");
fprintf(fp, " File name: <%s>", CHECKPTFILE);
fprintf(fp, "\n==================================================================\n");
fserr = 1;
}
}
/* trace kill file */
if (TRKILL == 1)
......
/*-----------------------------------------------------------------------------------------
* Copyright (C) 2013 For the list of authors, see file AUTHORS.
*
* This file is part of DENISE.
*
* DENISE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2.0 of the License only.
*
* DENISE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DENISE. See file COPYING and/or <http://www.gnu.org/licenses/gpl-2.0.html>.
-----------------------------------------------------------------------------------------*/
#include "fd.h"
void save_checkpoint(int nx1, int nx2, int ny1, int ny2,
float ** vx, float ** vy, float ** sxx, float ** syy, float ** sxy){
int i,j;
char myid[5];
char checkptfile[STRING_SIZE];
FILE *fp;
extern int MYID;
extern char CHECKPTFILE[STRING_SIZE];
sprintf(checkptfile,"%s",CHECKPTFILE);
sprintf(myid,".%d",MYID);
strcat(checkptfile,myid);
fp=fopen(checkptfile,"wb");
if (fp==NULL) err("CHECKPTFILE can't be opened !");
for (j=ny1;j<=ny2;j++){
for (i=nx1;i<=nx2;i++){
fwrite( &vx[j][i],sizeof(float),1,fp);
fwrite( &vy[j][i],sizeof(float),1,fp);
fwrite(&sxx[j][i],sizeof(float),1,fp);
fwrite(&syy[j][i],sizeof(float),1,fp);
fwrite(&sxy[j][i],sizeof(float),1,fp);
}
}
fclose(fp);
}
......@@ -43,7 +43,7 @@ void update_v_PML(int nx1, int nx2, int ny1, int ny2, int nt,
extern float DT, DH;
double time1, time2;
extern int MYID, QUELLTYP, QUELLTYPB, CHECKPTREAD, FDORDER;
extern int MYID, QUELLTYP, QUELLTYPB, FDORDER;
extern int FDORDER, INVMAT1;
extern int FREE_SURF, BOUNDARY, FW;
extern int NPROCX, NPROCY, POS[3];
......
......@@ -39,7 +39,7 @@ void update_v_PML_SH(int nx1, int nx2, int ny1, int ny2, int nt,
float sxz_x, syz_y;
extern float DT, DH;
double time1, time2;
extern int MYID, QUELLTYP, QUELLTYPB, CHECKPTREAD, FDORDER;
extern int MYID, QUELLTYP, QUELLTYPB, FDORDER;
extern int FDORDER, INVMAT1;
extern int FREE_SURF, BOUNDARY, FW;
extern int NPROCX, NPROCY, POS[3];
......
......@@ -43,7 +43,7 @@ void update_v_acoustic_PML(int nx1, int nx2, int ny1, int ny2, int nt,
extern float DT, DH;
double time1, time2;
extern int MYID, QUELLTYP, QUELLTYPB, CHECKPTREAD, FDORDER;
extern int MYID, QUELLTYP, QUELLTYPB, FDORDER;
extern int FDORDER, INVMAT1;
extern int FREE_SURF, BOUNDARY, FW;
extern int NPROCX, NPROCY, POS[3];
......
......@@ -41,7 +41,7 @@ void update_v_hc(int nx1, int nx2, int ny1, int ny2, int nt,
extern float DT, DH, FW;
double time1, time2;
extern int MYID, QUELLTYP, CHECKPTREAD, FDORDER;
extern int MYID, QUELLTYP, FDORDER;
extern FILE *FP;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment