CAMLprim value spoc_cublasDgemm(value transa, value transb, value m, value n, value k, value alpha, value a, value lda, value b, value ldb, value beta, value c, value ldc, value dev){ CAMLparam5(transa, transb, m, n, k); CAMLxparam5(alpha, a, lda, b, ldb); CAMLxparam4(beta, c, ldc, dev); CAMLlocal3(dev_vec_array, dev_vec, gi); CUdeviceptr d_A; CUdeviceptr d_B; CUdeviceptr d_C; int id; gi = Field(dev, 0); id = Int_val(Field(gi, 7)); GET_VEC(a, d_A); GET_VEC(b, d_B); GET_VEC(c, d_C); //CUBLAS_GET_CONTEXT; CUBLAS_GET_CONTEXT; cublasDgemm (Int_val(transa), Int_val(transb), Int_val(m), Int_val(n), Int_val(k), (double)Double_val(alpha), (double*) d_A, Int_val(lda), (double*) d_B, Int_val(ldb), (double) Double_val(beta), (double *)d_C, Int_val(ldc)); CUDA_RESTORE_CONTEXT; CAMLreturn(Val_unit); }
value f_i15_caml(value i0, value i1, value i2, value i3, value i4, value i5, value i6, value i7, value i8, value i9, value i10, value i11, value i12, value i13, value i14) { CAMLparam5(i0,i1,i2,i3,i4); CAMLxparam5(i5,i6,i7,i8,i9); CAMLxparam5(i10,i11,i12,i13,i14); int ii0 = Int_val(i0); int ii1 = Int_val(i1); int ii2 = Int_val(i2); int ii3 = Int_val(i3); int ii4 = Int_val(i4); int ii5 = Int_val(i5); int ii6 = Int_val(i6); int ii7 = Int_val(i7); int ii8 = Int_val(i8); int ii9 = Int_val(i9); int ii10= Int_val(i10); int ii11= Int_val(i11); int ii12= Int_val(i12); int ii13= Int_val(i13); int ii14= Int_val(i14); CAMLreturn(Val_int(f_i15(ii0,ii1,ii2,ii3,ii4,ii5,ii6,ii7,ii8,ii9,ii10,ii11,ii12,ii13,ii14))); }
CAMLprim value stub_xc_linux_build_native(value xc_handle, value domid, value mem_max_mib, value mem_start_mib, value image_name, value ramdisk_name, value cmdline, value features, value flags, value store_evtchn, value console_evtchn) { CAMLparam5(xc_handle, domid, mem_max_mib, mem_start_mib, image_name); CAMLxparam5(ramdisk_name, cmdline, features, flags, store_evtchn); CAMLxparam1(console_evtchn); CAMLlocal1(result); unsigned long store_mfn; unsigned long console_mfn; int r; struct xc_dom_image *dom; char c_protocol[64]; /* Copy the ocaml values into c-land before dropping the mutex */ xc_interface *xch = _H(xc_handle); unsigned int c_mem_start_mib = Int_val(mem_start_mib); uint32_t c_domid = _D(domid); char *c_image_name = strdup(String_val(image_name)); char *c_ramdisk_name = ramdisk_name == None_val ? NULL : strdup(String_val(Field(ramdisk_name, 0))); unsigned long c_flags = Int_val(flags); unsigned int c_store_evtchn = Int_val(store_evtchn); unsigned int c_console_evtchn = Int_val(console_evtchn); struct flags f; get_flags(&f,c_domid); xc_dom_loginit(xch); dom = xc_dom_allocate(xch, String_val(cmdline), String_val(features)); if (!dom) failwith_oss_xc(xch, "xc_dom_allocate"); configure_vcpus(xch, c_domid, f); configure_tsc(xch, c_domid, f); #ifdef XC_HAVE_DECOMPRESS_LIMITS if ( xc_dom_kernel_max_size(dom, f.kernel_max_size) ) failwith_oss_xc(xch, "xc_dom_kernel_max_size"); if ( xc_dom_ramdisk_max_size(dom, f.ramdisk_max_size) ) failwith_oss_xc(xch, "xc_dom_ramdisk_max_size"); #else if ( f.kernel_max_size || f.ramdisk_max_size ) { syslog(LOG_WARNING|LOG_DAEMON,"Kernel/Ramdisk limits set, but no support compiled in"); } #endif caml_enter_blocking_section(); r = xc_dom_linux_build(xch, dom, c_domid, c_mem_start_mib, c_image_name, c_ramdisk_name, c_flags, c_store_evtchn, &store_mfn, c_console_evtchn, &console_mfn); caml_leave_blocking_section(); #ifndef XEN_UNSTABLE strncpy(c_protocol, xc_dom_get_native_protocol(dom), 64); #else memset(c_protocol, '\0', 64); #endif free(c_image_name); free(c_ramdisk_name); xc_dom_release(dom); if (r != 0) failwith_oss_xc(xch, "xc_dom_linux_build"); result = caml_alloc_tuple(3); Store_field(result, 0, caml_copy_nativeint(store_mfn)); Store_field(result, 1, caml_copy_nativeint(console_mfn)); Store_field(result, 2, caml_copy_string(c_protocol)); CAMLreturn(result); }