From c311f90ad81fa77448e8af92a5f8271a45533b2c Mon Sep 17 00:00:00 2001
From: Jan Thorbecke <janth@xs4all.nl>
Date: Thu, 7 Mar 2019 10:57:13 +0100
Subject: [PATCH] linking with MKL for MDD

---
 MDD/Makefile       | 11 ++++++++---
 MDD/deconvolve.c   |  1 -
 MDD/readShotData.c |  5 +----
 README             | 12 ++++++++++++
 4 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/MDD/Makefile b/MDD/Makefile
index 7cb5f2d..bbc45bb 100644
--- a/MDD/Makefile
+++ b/MDD/Makefile
@@ -5,9 +5,14 @@ include ../Make_include
 ########################################################################
 # define general include and system library
 ALLINC  = -I.
-LIBS += -mkl -L$L -lgenfft $(LIBSM)
-CFLAGS += -I$(MKLROOT)/include  
-
+#BLAS libs with Intel compiler
+#LIBS += -mkl -L$L -lgenfft $(LIBSM)
+#General BLAS library
+LIBS += -L$L -lgenfft $(LIBSM)
+#General BLAS library
+LIBS += $(BLAS)
+
+#CFLAGS += -I$(MKLROOT)/include  
 #LIBS += -lblas -llapack -L$L -lgenfft $(LIBSM) -lc -lm
 
 all: mdd 
diff --git a/MDD/deconvolve.c b/MDD/deconvolve.c
index 2ef6d49..6b88d68 100644
--- a/MDD/deconvolve.c
+++ b/MDD/deconvolve.c
@@ -3,7 +3,6 @@
 #include <assert.h>
 #include <math.h>
 #include <string.h>
-#include<mkl_cblas.h>
 
 typedef struct { /* complex number */
 	float r,i;
diff --git a/MDD/readShotData.c b/MDD/readShotData.c
index ce77436..20f953e 100644
--- a/MDD/readShotData.c
+++ b/MDD/readShotData.c
@@ -5,9 +5,6 @@
 #include "segy.h"
 #include <assert.h>
 
-extern FILE *fopen64 (__const char *__restrict __filename,
-                      __const char *__restrict __modes);
-
 typedef struct { /* complex number */
         float r,i;
 } complex;
@@ -34,7 +31,7 @@ int readShotData(char *filename, float xmin, float dx, float *xrcv, float *xsrc,
 	/* Reading first header  */
 
 	if (filename == NULL) fp = stdin;
-	else fp = fopen64( filename, "r" );
+	else fp = fopen( filename, "r" );
 	if ( fp == NULL ) {
 		fprintf(stderr,"input file %s has an error\n", filename);
 		perror("error in opening file: ");
diff --git a/README b/README
index 6b9f9f5..16f6b37 100644
--- a/README
+++ b/README
@@ -88,6 +88,18 @@ To reproduce the Figures shown in the GEOPHYICS paper "Implementation of the Mar
 
 To reproduce the Figures shown in the Scientific Reports paper "Virtual acoustics in inhomogeneous media with single-sided access" the scripts in marchenko/demo/ScientificReports directory can be used. The README in this directory gives more instructions and guidelines. 
 
+MDD
+---
+The MDD kernels depend on BLAS and LAPACK calls. Free downloads of these libraries can be found on 
+
+https://www.netlib.org/blas/index.html
+https://www.netlib.org/lapack/index.html
+
+If you are running on Intel processors you can download (for free) Intel's highly optimised MKL package:
+
+https://software.intel.com/en-us/mkl/choose-download
+
+
 MISC
 ----
 Other make commands which can be useful:
-- 
GitLab