//public void SetGraphStructure(nvgraphCSRTopology32I topologyData) //{ // res = NVGraphNativeMathods.nvgraphSetGraphStructure(_context, _descr, ref topologyData, nvgraphTopologyType.CSR32); // Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvgraphSetGraphStructure", res)); // if (res != nvgraphStatus.Success) throw new NVGraphException(res); //} //public void SetGraphStructure(nvgraphCSCTopology32I topologyData) //{ // res = NVGraphNativeMathods.nvgraphSetGraphStructure(_context, _descr, ref topologyData, nvgraphTopologyType.CSC32); // Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvgraphSetGraphStructure", res)); // if (res != nvgraphStatus.Success) throw new NVGraphException(res); // } public void SetGraphStructure(nvgraphTopologyBase topologyData) { nvgraphTopologyType type; if (topologyData is nvgraphCSRTopology32I) { type = nvgraphTopologyType.CSR32; } else { if (topologyData is nvgraphCSCTopology32I) { type = nvgraphTopologyType.CSC32; } else { type = nvgraphTopologyType.COO32; } } res = NVGraphNativeMathods.nvgraphSetGraphStructure(_context, _descr, topologyData, type); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvgraphSetGraphStructure", res)); if (res != nvgraphStatus.Success) { throw new NVGraphException(res); } }
public void WidestPath(SizeT weight_index, ref int source_vert, SizeT widest_path_index) { res = NVGraphNativeMathods.nvgraphWidestPath(_context, _descr, weight_index, ref source_vert, widest_path_index); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvgraphWidestPath", res)); if (res != nvgraphStatus.Success) { throw new NVGraphException(res); } }
public void GetEdgeData <Type>(CudaDeviceVariable <Type> edgeData, SizeT setnum) where Type : struct { res = NVGraphNativeMathods.nvgraphGetEdgeData(_context, _descr, edgeData.DevicePointer, setnum); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvgraphGetEdgeData", res)); if (res != nvgraphStatus.Success) { throw new NVGraphException(res); } }
public void AllocateEdgeData(cudaDataType[] settypes) { res = NVGraphNativeMathods.nvgraphAllocateEdgeData(_context, _descr, settypes.Length, settypes); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvgraphAllocateEdgeData", res)); if (res != nvgraphStatus.Success) { throw new NVGraphException(res); } }
// public void GetGraphStructure(ref nvgraphCSRTopology32I topologyData) //{ // nvgraphTopologyType type = nvgraphTopologyType.CSR32; // res = NVGraphNativeMathods.nvgraphGetGraphStructure(_context, _descr, ref topologyData, ref type); // Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvgraphGetGraphStructure", res)); // if (res != nvgraphStatus.Success) throw new NVGraphException(res); //} //public void GetGraphStructure(ref nvgraphCSCTopology32I topologyData) // { // nvgraphTopologyType type = nvgraphTopologyType.CSC32; // res = NVGraphNativeMathods.nvgraphGetGraphStructure(_context, _descr, ref topologyData, ref type); // Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvgraphGetGraphStructure", res)); // if (res != nvgraphStatus.Success) throw new NVGraphException(res); //} public void GetGraphStructure(nvgraphTopologyBase topologyData, ref nvgraphTopologyType type) { res = NVGraphNativeMathods.nvgraphGetGraphStructure(_context, _descr, topologyData, ref type); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvgraphGetGraphStructure", res)); if (res != nvgraphStatus.Success) { throw new NVGraphException(res); } }
/// <summary> /// </summary> public GraphContext() { _context = new nvgraphContext(); res = NVGraphNativeMathods.nvgraphCreate(ref _context); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvgraphCreate", res)); if (res != nvgraphStatus.Success) { throw new NVGraphException(res); } }
/// <summary> /// </summary> internal GraphDescriptor(nvgraphContext context) { _descr = new nvgraphGraphDescr(); _context = context; res = NVGraphNativeMathods.nvgraphCreateGraphDescr(_context, ref _descr); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvgraphCreateGraphDescr", res)); if (res != nvgraphStatus.Success) { throw new NVGraphException(res); } }
/// <summary> /// For IDisposable /// </summary> /// <param name="fDisposing"></param> protected virtual void Dispose(bool fDisposing) { if (fDisposing && !disposed) { res = NVGraphNativeMathods.nvgraphDestroy(_context); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvgraphDestroy", res)); disposed = true; } if (!fDisposing && !disposed) { Debug.WriteLine(String.Format("ManagedCUDA.NVGraph not-disposed warning: {0}", this.GetType())); } }
public GraphDescriptor ExtractSubgraphByEdge(int[] subedges) { GraphDescriptor subdescr = new GraphDescriptor(_context); res = NVGraphNativeMathods.nvgraphExtractSubgraphByEdge(_context, _descr, subdescr.GraphDescr, subedges, subedges.Length); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvgraphExtractSubgraphByEdge", res)); if (res != nvgraphStatus.Success) { throw new NVGraphException(res); } return(subdescr); }
public void Pagerank(SizeT weight_index, Array alpha, SizeT bookmark_index, int has_guess, SizeT pagerank_index, float tolerance, int max_iter) { GCHandle alphaHandle = GCHandle.Alloc(alpha, GCHandleType.Pinned); try { res = NVGraphNativeMathods.nvgraphPagerank(_context, _descr, weight_index, alphaHandle.AddrOfPinnedObject(), bookmark_index, has_guess, pagerank_index, tolerance, max_iter); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvgraphPagerank", res)); if (res != nvgraphStatus.Success) { throw new NVGraphException(res); } } finally { alphaHandle.Free(); } }
public void GetEdgeData(Array edgeData, SizeT setnum) { GCHandle handle = GCHandle.Alloc(edgeData, GCHandleType.Pinned); try { res = NVGraphNativeMathods.nvgraphGetEdgeData(_context, _descr, handle.AddrOfPinnedObject(), setnum); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvgraphGetEdgeData", res)); if (res != nvgraphStatus.Success) { throw new NVGraphException(res); } } finally { handle.Free(); } }
public void SrSpmv(SizeT weight_index, Array alpha, SizeT x_index, Array beta, SizeT y_index, nvgraphSemiring SR) { GCHandle alphaHandle = GCHandle.Alloc(alpha, GCHandleType.Pinned); GCHandle betaHandle = GCHandle.Alloc(beta, GCHandleType.Pinned); try { res = NVGraphNativeMathods.nvgraphSrSpmv(_context, _descr, weight_index, alphaHandle.AddrOfPinnedObject(), x_index, betaHandle.AddrOfPinnedObject(), y_index, SR); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvgraphSrSpmv", res)); if (res != nvgraphStatus.Success) { throw new NVGraphException(res); } } finally { alphaHandle.Free(); betaHandle.Free(); } }
private static string GetInternalNameFromNVgraphStatus(nvgraphStatus error) { string val = NVGraphNativeMathods.nvgraphStatusGetString(error); return(val); }