Commit 0fea5ab9 authored by myron's avatar myron
Browse files

finished ant with esynth

parent 758a5daf
...@@ -84,6 +84,16 @@ if(NOT CMAKE_BUILD_TYPE) ...@@ -84,6 +84,16 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE DEBUG) set(CMAKE_BUILD_TYPE DEBUG)
endif() endif()
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
## set(CMAKE_CXX_FLAGS "-Wextra -Wall -mfpmath=sse -Ofast -flto -mcpu=native ${CMAKE_CXX_FLAGS} " ) ## set(CMAKE_CXX_FLAGS "-Wextra -Wall -mfpmath=sse -Ofast -flto -mcpu=native ${CMAKE_CXX_FLAGS} " )
set(CMAKE_CXX_FLAGS_DEBUG "-g -Wextra -Wall -fopenmp ${CMAKE_CXX_FLAGS} " ) set(CMAKE_CXX_FLAGS_DEBUG "-g -Wextra -Wall -fopenmp ${CMAKE_CXX_FLAGS} " )
set(CMAKE_CXX_FLAGS_RELEASE " -g -Wextra -Wall -fopenmp -Ofast -mtune=native${CMAKE_CXX_FLAGS} " ) set(CMAKE_CXX_FLAGS_RELEASE " -g -Wextra -Wall -fopenmp -Ofast -mtune=native${CMAKE_CXX_FLAGS} " )
......
...@@ -192,6 +192,7 @@ public: ...@@ -192,6 +192,7 @@ public:
int DIMZ = dimpars.DIMZ; int DIMZ = dimpars.DIMZ;
int DIMY = dimpars.DIMY; int DIMY = dimpars.DIMY;
int DIMX = dimpars.DIMX; int DIMX = dimpars.DIMX;
#pragma omp parallel for
for(int ie=0 ; ie<NE; ie++) { for(int ie=0 ; ie<NE; ie++) {
for( int iz=0; iz<DIMZ; iz++) { for( int iz=0; iz<DIMZ; iz++) {
for( int iy=0; iy<DIMY; iy++) { for( int iy=0; iy<DIMY; iy++) {
...@@ -213,6 +214,7 @@ public: ...@@ -213,6 +214,7 @@ public:
int DIMZ = dimpars.DIMZ; int DIMZ = dimpars.DIMZ;
int DIMY = dimpars.DIMY; int DIMY = dimpars.DIMY;
int DIMX = dimpars.DIMX; int DIMX = dimpars.DIMX;
#pragma omp parallel for
for(int ie=NE-1 ; ie<NE; ie++) { for(int ie=NE-1 ; ie<NE; ie++) {
for( int iz=0; iz<DIMZ; iz++) { for( int iz=0; iz<DIMZ; iz++) {
for( int iy=0; iy<DIMY; iy++) { for( int iy=0; iy<DIMY; iy++) {
...@@ -228,6 +230,7 @@ public: ...@@ -228,6 +230,7 @@ public:
int NE = dimpars.NE; int NE = dimpars.NE;
int NV = dimpars.NV; int NV = dimpars.NV;
int NROI = dimpars.NROI; int NROI = dimpars.NROI;
#pragma omp parallel for
for(int ir=0; ir<NROI; ir++) { for(int ir=0; ir<NROI; ir++) {
for(int ie1=0 ; ie1<NE; ie1++) { for(int ie1=0 ; ie1<NE; ie1++) {
for(int ie2=0 ; ie2<NE; ie2++) { for(int ie2=0 ; ie2<NE; ie2++) {
...@@ -246,6 +249,7 @@ public: ...@@ -246,6 +249,7 @@ public:
int NE = dimpars.NE; int NE = dimpars.NE;
int NROI = dimpars.NROI; int NROI = dimpars.NROI;
int DIMX = dimpars.DIMX; int DIMX = dimpars.DIMX;
#pragma omp parallel for
for(int ie1=0 ; ie1<NE; ie1++) { for(int ie1=0 ; ie1<NE; ie1++) {
for(int ie2=0 ; ie2<NE; ie2++) { for(int ie2=0 ; ie2<NE; ie2++) {
for(int ix1=0 ; ix1<DIMX; ix1++) { for(int ix1=0 ; ix1<DIMX; ix1++) {
...@@ -278,7 +282,7 @@ public: ...@@ -278,7 +282,7 @@ public:
memset(Ctmp,0, NV*NROI*DIMZ*DIMY*DIMX *sizeof(float)); memset(Ctmp,0, NV*NROI*DIMZ*DIMY*DIMX *sizeof(float));
float tmp=0; float tmp=0;
#pragma parallel for #pragma omp parallel for
for(int iv=0 ; iv<NV; iv++) { for(int iv=0 ; iv<NV; iv++) {
for(int ir=0 ; ir<NROI; ir++) { for(int ir=0 ; ir<NROI; ir++) {
for( int iz=0; iz<DIMZ; iz++) { for( int iz=0; iz<DIMZ; iz++) {
...@@ -296,7 +300,6 @@ public: ...@@ -296,7 +300,6 @@ public:
} }
} }
#pragma parallel for
for(int ir=0 ; ir<NROI; ir++) { for(int ir=0 ; ir<NROI; ir++) {
double forza =0; double forza =0;
float tmp = 0.0f ; float tmp = 0.0f ;
...@@ -373,6 +376,7 @@ public: ...@@ -373,6 +376,7 @@ public:
int DIMY = dimpars.DIMY; int DIMY = dimpars.DIMY;
int DIMX = dimpars.DIMX; int DIMX = dimpars.DIMX;
#pragma omp parallel for
for(int ie1=0 ; ie1<NE; ie1++) { for(int ie1=0 ; ie1<NE; ie1++) {
for(int iz=0; iz< DIMZ; iz++) { for(int iz=0; iz< DIMZ; iz++) {
for(int iy=0; iy< DIMY; iy++) { for(int iy=0; iy< DIMY; iy++) {
...@@ -719,14 +723,16 @@ int main(int argc, char ** argv) { ...@@ -719,14 +723,16 @@ int main(int argc, char ** argv) {
pb.settoVal(Xtmp ,1.0f); pb.settoVal(Xtmp ,1.0f);
for(int i=0; i< 60; i++) { for(int i=0; i< 10; i++) {
if(0) { if(0) {
pb.copyScal(fftmp, ffacts, 1.0); pb.copyScal(fftmp, ffacts, 1.0);
pb.setFreeFacts( fftmp , X) ; pb.setFreeFacts( fftmp , X) ;
} }
pb.applyMatA(grad , Xtmp); pb.applyMatA(grad , Xtmp);
pb.gradReg_2_Add(grad, Xtmp , betaE, betaV) ; pb.gradReg_2_Add(grad, Xtmp , betaE, betaV) ;
double norma = sqrt(pb.scalar(grad, grad )); double norma = sqrt(pb.scalar(grad, grad ));
pb.copyScal( Xtmp, grad,1.0/norma ) ; pb.copyScal( Xtmp, grad,1.0/norma ) ;
printf("Norma Lipschitz %e\n", norma); printf("Norma Lipschitz %e\n", norma);
......
...@@ -27,7 +27,7 @@ def main(): ...@@ -27,7 +27,7 @@ def main():
elastic_scan_for_peaks_shifts = 38 elastic_scan_for_peaks_shifts = 38
energy_custom_grid = 9.96595 + np.arange(72)*0.0005 energy_custom_grid = 9.96595 + np.arange(62)*0.0005
### custom_components_file = "abc.h5" ### custom_components_file = "abc.h5"
custom_components_file = None custom_components_file = None
...@@ -64,15 +64,13 @@ def main(): ...@@ -64,15 +64,13 @@ def main():
"do_step_scalars" : False, "do_step_scalars" : False,
"do_step_interpolation_coefficients": True, "do_step_interpolation_coefficients": False,
"do_step_finalise_for_fit": False "do_step_finalise_for_fit": True
} }
os.system("mkdir results") os.system("mkdir results")
scalar_products_target_file = "results/scalar_products_target_file.h5" scalar_products_target_file = "results/scalar_products_target_file.h5"
roi_target_path = "results/myrois.h5:/ROIS" roi_target_path = "results/myrois.h5:/ROIS"
......
Supports Markdown
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