def compile_form(form, prefix="form", parameters=None): """Compiles a UFL form into a set of assembly kernels. :arg form: UFL form :arg prefix: kernel name will start with this string :arg parameters: parameters object :returns: list of kernels """ cpu_time = time.time() assert isinstance(form, Form) fd = ufl_utils.compute_form_data(form) logger.info(GREEN % "compute_form_data finished in %g seconds.", time.time() - cpu_time) kernels = [] for integral_data in fd.integral_data: start = time.time() kernel = compile_integral(integral_data, fd, prefix, parameters) if kernel is not None: kernels.append(kernel) logger.info(GREEN % "compile_integral finished in %g seconds.", time.time() - start) logger.info(GREEN % "TSFC finished in %g seconds.", time.time() - cpu_time) return kernels
def compile_form(form, prefix="form", parameters=None): """Compiles a UFL form into a set of assembly kernels. :arg form: UFL form :arg prefix: kernel name will start with this string :arg parameters: parameters object :returns: list of kernels """ cpu_time = time.time() assert isinstance(form, Form) # determine if we're in complex mode; coffee mode does not support complex complx = parameters and "scalar_type" in parameters and 'complex' in parameters[ "scalar_type"] if complx: parameters["mode"] = 'vanilla' fd = ufl_utils.compute_form_data(form, complex_mode=complx) logger.info(GREEN % "compute_form_data finished in %g seconds.", time.time() - cpu_time) kernels = [] for integral_data in fd.integral_data: start = time.time() kernel = compile_integral(integral_data, fd, prefix, parameters) if kernel is not None: kernels.append(kernel) logger.info(GREEN % "compile_integral finished in %g seconds.", time.time() - start) logger.info(GREEN % "TSFC finished in %g seconds.", time.time() - cpu_time) return kernels
def compile_form(form, prefix="form", parameters=None, interface=None, coffee=True, diagonal=False): """Compiles a UFL form into a set of assembly kernels. :arg form: UFL form :arg prefix: kernel name will start with this string :arg parameters: parameters object :arg coffee: compile coffee kernel instead of loopy kernel :arg diagonal: Are we building a kernel for the diagonal of a rank-2 element tensor? :returns: list of kernels """ cpu_time = time.time() assert isinstance(form, Form) # Determine whether in complex mode: # complex nodes would break the refactoriser. complex_mode = parameters and is_complex(parameters.get("scalar_type")) if complex_mode: logger.warning("Disabling whole expression optimisations" " in GEM for supporting complex mode.") parameters = parameters.copy() parameters["mode"] = 'vanilla' fd = ufl_utils.compute_form_data(form, complex_mode=complex_mode) logger.info(GREEN % "compute_form_data finished in %g seconds.", time.time() - cpu_time) kernels = [] for integral_data in fd.integral_data: start = time.time() kernel = compile_integral(integral_data, fd, prefix, parameters, interface=interface, coffee=coffee, diagonal=diagonal) if kernel is not None: kernels.append(kernel) logger.info(GREEN % "compile_integral finished in %g seconds.", time.time() - start) logger.info(GREEN % "TSFC finished in %g seconds.", time.time() - cpu_time) return kernels