Index: /issm/trunk-jpl/src/m/os/ismpi.m
===================================================================
--- /issm/trunk-jpl/src/m/os/ismpi.m	(revision 13303)
+++ /issm/trunk-jpl/src/m/os/ismpi.m	(revision 13303)
@@ -0,0 +1,33 @@
+function flag=ismpi()
+%ISMPI - figure out if MPI package was compiled with ISSM
+%
+%   Usage:
+%       flag=ismpi();
+
+
+configfile=[issmdir() '/bin/config.h']; %should find it in the install target
+if ~exist(configfile,'file'),
+	error(['File ' configfile ' not found. ISSM has not been configured yet!']);
+end
+
+%go through the file, and recover the line we want
+flag=2;
+fid=fopen(configfile,'r');
+if(fid==-1), error(['could not open file: ' configfile]); end
+
+while(true),
+	tline=fgets(fid);
+	if ~ischar(tline), break, end
+	if strncmp(tline,'/* #undef _HAVE_MPI_ */',23),
+		flag=0;
+		break;
+	end
+	if  strncmp(tline,'#define _HAVE_MPI_',18),
+		flag=1;
+		break;
+	end
+end
+fclose(fid);
+if flag==2,
+	error('could not determine whether MPI was or was not compiled');
+end
Index: /issm/trunk-jpl/src/m/os/ismpi.py
===================================================================
--- /issm/trunk-jpl/src/m/os/ismpi.py	(revision 13303)
+++ /issm/trunk-jpl/src/m/os/ismpi.py	(revision 13303)
@@ -0,0 +1,37 @@
+import os
+from issmdir import *
+from MatlabFuncs import *
+
+def ismpi():
+	"""
+	ISMPI - figure out if MPI package was compiled with ISSM
+ 
+	   Usage:
+	      flag=ismpi();
+	"""
+
+	configfile=os.path.join(issmdir(),'bin','config.h')    #should find it in the install target
+	if not os.path.exists(configfile):
+		raise RuntimeError("File '%s' not found. ISSM has not been configured yet!" % configfile)
+
+	#go through the file, and recover the line we want
+	flag=2
+	try:
+		fid=open(configfile,'r')
+	except IOError as e:
+		raise IOError("could not open file: '%s'" % configfile)
+
+	for tline in fid:
+		if strncmp(tline,'/* #undef _HAVE_MPI_ */',23):
+			flag=0
+			break
+		if  strncmp(tline,'#define _HAVE_MPI_',18):
+			flag=1
+			break
+
+	fid.close()
+	if flag==2:
+		raise RuntimeError("could not determine whether MPI was or was not compiled.")
+
+	return flag
+
