Index: sasmodels/compare.py
===================================================================
--- sasmodels/compare.py	(revision dc056b933d551c1a9afcfa3456bf140750f54177)
+++ sasmodels/compare.py	(revision 319ab1478261080f41492caa7ea3b5e7f58409c8)
@@ -278,7 +278,18 @@
 
     # OpenCl calculation
-    if Nocl > 0:
+    if Nocl > 0 and "-ctypes" in opts and "-sasview" in opts:
+        try:
+            ocl, ocl_time = eval_sasview(model_definition, pars, data, Ncpu)
+            base = "sasview"
+            #print "ocl/sasview", (ocl-pars['background'])/(cpu-pars['background'])
+            print "sasview t=%.1f ms, intensity=%.0f"%(ocl_time, sum(ocl))
+            #print "sasview",cpu
+        except ImportError:
+            traceback.print_exc()
+            Ncpu = 0
+    elif Nocl > 0:
         ocl, ocl_time = eval_opencl(model_definition, pars, data,
                                     dtype=dtype, cutoff=cutoff, Nevals=Nocl)
+        base = "ocl"
         print "opencl t=%.1f ms, intensity=%.0f"%(ocl_time, sum(ocl))
         #print "ocl", ocl
@@ -311,6 +322,6 @@
         #bad = (relerr>1e-4)
         #print relerr[bad],cpu[bad],ocl[bad],data.qx_data[bad],data.qy_data[bad]
-        _print_stats("|ocl-%s|"%comp+(" "*(3+len(comp))), resid)
-        _print_stats("|(ocl-%s)/%s|"%(comp,comp), relerr)
+        _print_stats("|%s-%s|"%(base,comp)+(" "*(3+len(comp))), resid)
+        _print_stats("|(%s-%s)/%s|"%(base,comp,comp), relerr)
 
     # Plot if requested
@@ -325,5 +336,5 @@
         if Ncpu > 0: plt.subplot(132)
         plot_theory(data, ocl, view=view, plot_data=False)
-        plt.title("opencl t=%.1f ms"%ocl_time)
+        plt.title("%s t=%.1f ms"%(base,ocl_time))
         #cbar_title = "log I"
     if Ncpu > 0 and Nocl > 0:
@@ -388,5 +399,5 @@
     -preset*/-random[=seed] preset or random parameters
     -mono/-poly* force monodisperse/polydisperse
-    -ctypes/-sasview* whether cpu is tested using sasview or ctypes
+    -ctypes/-sasview* selects gpu:cpu, gpu:sasview, or sasview:cpu if both
     -cutoff=1e-5* cutoff value for including a point in polydispersity
     -pars/-nopars* prints the parameter set or not
@@ -406,5 +417,5 @@
 NAME_OPTIONS = set([
     'plot','noplot',
-    'single','double','longdouble',
+    'single','double','quad',
     'lowq','midq','highq','exq',
     '2d','1d',
@@ -442,5 +453,6 @@
 def main():
     opts = [arg for arg in sys.argv[1:] if arg.startswith('-')]
-    args = [arg for arg in sys.argv[1:] if not arg.startswith('-')]
+    popts = [arg for arg in sys.argv[1:] if not arg.startswith('-') and '=' in arg]
+    args = [arg for arg in sys.argv[1:] if not arg.startswith('-') and '=' not in arg]
     models = "\n    ".join("%-15s"%v for v in MODELS)
     if len(args) == 0:
@@ -451,4 +463,6 @@
         print "Model %r not available. Use one of:\n    %s"%(args[0],models)
         sys.exit(1)
+    if len(args) > 3:
+        print("expected parameters: model Nopencl Nsasview")
 
     invalid = [o[1:] for o in opts
@@ -476,6 +490,6 @@
     # Fill in parameters given on the command line
     set_pars = {}
-    for arg in args[3:]:
-        k,v = arg.split('=')
+    for arg in popts:
+        k,v = arg.split('=',1)
         if k not in pars:
             # extract base name without distribution
Index: sasmodels/compare_many.py
===================================================================
--- sasmodels/compare_many.py	(revision b514adfe3f715e5ad1efba9c3b18ed3f086b37af)
+++ sasmodels/compare_many.py	(revision 319ab1478261080f41492caa7ea3b5e7f58409c8)
@@ -11,5 +11,5 @@
                       columnize, constrain_pars)
 
-def get_stats(target, value, index):
+def calc_stats(target, value, index):
     resid = abs(value-target)[index]
     relerr = resid/target[index]
@@ -34,5 +34,6 @@
     print(','.join('"%s"'%c for c in columns))
 
-def compare_instance(name, data, index, N=1, mono=True, cutoff=1e-5):
+def compare_instance(name, data, index, N=1, mono=True, cutoff=1e-5,
+                     precision='double'):
     model_definition = core.load_model_definition(name)
     pars = get_demo_pars(model_definition)
@@ -41,5 +42,10 @@
     print(header)
 
-    def trymodel(fn, *args, **kw):
+    # Some not very clean macros for evaluating the models and checking the
+    # results.  They freely use variables from the current scope, even some
+    # which have not been defined yet, complete with abuse of mutable lists
+    # to allow them to update values in the current scope since nonlocal
+    # declarations are not available in python 2.7.
+    def try_model(fn, *args, **kw):
         try:
             result, _ = fn(model_definition, pars_i, data, *args, **kw)
@@ -54,8 +60,14 @@
                 result = np.NaN*data.x
         return result
+    def check_model(label, target, value, acceptable):
+        stats = calc_stats(target, value, index)
+        columns.extend(stats)
+        labels.append('GPU single')
+        max_diff[0] = max(max_diff[0], stats[0])
+        good[0] = good[0] and (stats[0] < acceptable)
 
     num_good = 0
     first = True
-    max_diff = 0
+    max_diff = [0]
     for k in range(N):
         print >>sys.stderr, name, k
@@ -64,36 +76,27 @@
         if mono: suppress_pd(pars_i)
 
-        good = True
+        good = [True]
         labels = []
         columns = []
-        if 1:
-            sasview_value = trymodel(eval_sasview)
+        #target = try_model(eval_sasview)
+        target = try_model(eval_opencl, dtype='longdouble', cutoff=cutoff)
+        if precision == 'single':
+            value = try_model(eval_opencl, dtype='single', cutoff=cutoff)
+            check_model('GPU single', target, value, 5e-5)
+            single_value = value  # remember for single/double comparison
+        elif precision == 'double':
+            if environment().has_double:
+                label = 'GPU double'
+                value = try_model(eval_opencl, dtype='double', cutoff=cutoff)
+            else:
+                label = 'CPU double'
+                value = try_model(eval_ctypes, dtype='double', cutoff=cutoff)
+            check_model(label, target, value, 5e-14)
+            double_value = value  # remember for single/double comparison
+        elif precision == 'quad':
+            value = try_model(eval_opencl, dtype='longdouble', cutoff=cutoff)
+            check_model('CPU quad', target, value, 5e-14)
         if 0:
-            gpu_single_value = trymodel(eval_opencl, dtype='single', cutoff=cutoff)
-            stats = get_stats(sasview_value, gpu_single_value, index)
-            columns.extend(stats)
-            labels.append('GPU single')
-            max_diff = max(max_diff, stats[0])
-            good = good and (stats[0] < 5e-5)
-        if 0 and environment().has_double:
-            gpu_double_value = trymodel(eval_opencl, dtype='double', cutoff=cutoff)
-            stats = get_stats(sasview_value, gpu_double_value, index)
-            columns.extend(stats)
-            labels.append('GPU double')
-            max_diff = max(max_diff, stats[0])
-            good = good and (stats[0] < 1e-12)
-        if 1:
-            cpu_double_value = trymodel(eval_ctypes, dtype='double', cutoff=cutoff)
-            stats = get_stats(sasview_value, cpu_double_value, index)
-            columns.extend(stats)
-            labels.append('CPU double')
-            max_diff = max(max_diff, stats[0])
-            good = good and (stats[0] < 1e-12)
-        if 0:
-            stats = get_stats(cpu_double_value, gpu_single_value, index)
-            columns.extend(stats)
-            labels.append('single/double')
-            max_diff = max(max_diff, stats[0])
-            good = good and (stats[0] < 5e-5)
+            check_model('single/double', double_value, single_value, 5e-5)
 
         columns += [v for _,v in sorted(pars_i.items())]
@@ -101,13 +104,13 @@
             print_column_headers(pars_i, labels)
             first = False
-        if good:
+        if good[0]:
             num_good += 1
         else:
             print(("%d,"%seed)+','.join("%g"%v for v in columns))
-    print '"good","%d/%d","max diff",%g'%(num_good, N, max_diff)
+    print '"good","%d/%d","max diff",%g'%(num_good, N, max_diff[0])
 
 
 def print_usage():
-    print "usage: compare_many.py MODEL COUNT (1dNQ|2dNQ) (CUTOFF|mono)"
+    print "usage: compare_many.py MODEL COUNT (1dNQ|2dNQ) (CUTOFF|mono) (single|double|quad)"
 
 
@@ -138,4 +141,6 @@
 is set in compare.py defaults for each model.
 
+PRECISION is the floating point precision to use for comparisons.
+
 Available models:
 """)
@@ -143,5 +148,5 @@
 
 def main():
-    if len(sys.argv) == 1:
+    if len(sys.argv) != 6:
         print_help()
         sys.exit(1)
@@ -159,5 +164,7 @@
         mono = sys.argv[4] == 'mono'
         cutoff = float(sys.argv[4]) if not mono else 0
+        precision = sys.argv[5]
     except:
+        traceback.print_exc()
         print_usage()
         sys.exit(1)
@@ -166,5 +173,6 @@
     model_list = [model] if model != "all" else MODELS
     for model in model_list:
-        compare_instance(model, data, index, N=count, mono=mono, cutoff=cutoff)
+        compare_instance(model, data, index, N=count, mono=mono,
+                         cutoff=cutoff, precision=precision)
 
 if __name__ == "__main__":
Index: sasmodels/models/lamellarPC_kernel.c
===================================================================
--- sasmodels/models/lamellarPC_kernel.c	(revision f734e7d992ea6f2199f478553447ff0dbe047559)
+++ sasmodels/models/lamellarPC_kernel.c	(revision 319ab1478261080f41492caa7ea3b5e7f58409c8)
@@ -33,5 +33,5 @@
 	
 	ww = exp(-qval*qval*pd*pd*davg*davg/2.0);
-	
+
 	//calculate the n1 contribution
 	an = paraCryst_an(ww,qval,davg,n1);
@@ -43,5 +43,5 @@
 	an = paraCryst_an(ww,qval,davg,n2);
 	Snq = paraCryst_sn(ww,qval,davg,n2,an);
-	
+
 	Znq += (1.0-xn)*Snq;
 	
@@ -57,5 +57,5 @@
 	inten = 2.0*M_PI*contr*contr*Pbil*Znq/(qval*qval);
 	inten *= 1.0e-04;
-	
+//printf("q=%.7e wwm1=%g ww=%.5e an=% 12.5e Snq=% 12.5e Znq=% 12.5e Pbil=% 12.5e\n",qval,wwm1,ww,an,Snq,Znq,Pbil);
 	return(inten);
 }
@@ -66,5 +66,5 @@
 	
 	double Snq;
-	
+
 	Snq = an/( (double)Nlayers*pow((1.0+ww*ww-2.0*ww*cos(qval*davg)),2) );
 	
