SqueezeBrains SDK 1.13
InitLibrary.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6using sb_cs;
7using Tutorials_Common;
8
10{
23 {
24 static SbError execute()
25 {
26 SbError err = SbError.SB_ERR_NONE;
27
28 Console.WriteLine("Initialize the SqueezeBrains library");
29 err = Sb.Init("../../../sb.lic");
30 if (err != SbError.SB_ERR_NONE)
31 {
32 Console.WriteLine("Sb.Init failed with error " + err);
33 return err;
34 }
35
36 SbInfo info = Sb.GetInfo(1);
37 info.Refresh(0);
38 Console.WriteLine("sb ver. " + info.version_str + ", compiled on " + info.compile_date + " " + info.compile_time);
39
40 Console.WriteLine("Wait for license...");
41 err = Common.WaitLicense();
42 if (err != SbError.SB_ERR_NONE)
43 {
44 Console.WriteLine("SbLicense.WaitLicense failed with error " + err);
45 return err;
46 }
47
48 // Now the SqueezeBrains Library is initialized and it is possible to use any function of the library
49
50 info.Dispose();
51 Console.WriteLine("Release SqueezeBrains library");
52 Sb.Release();
53
54 Console.WriteLine("Press ENTER to terminate\n");
55 Console.ReadKey();
56
57 return err;
58 }
59
60 static void Main(string[] args)
61 {
62 execute();
63 }
64 }
65}
Tutorial 1 - How to initialize the library
Definition: InitLibrary.cs:23
Sb Main Class
Definition: cs_sb.h:374
static SbError Release()
Releases all the resources allocated in the library
static SbError Init(String ^ license_file)
Init the SB Library. The function initializes all the functionalities of the library including the li...
static SbInfo GetInfo(int gpu_info)
The function gets information of the sb library and the available computational devices
Info class that wraps the sb_t_info structure. You must call the Dispose() method to free all the re...
Definition: cs_sb.h:306
String compile_time
String of the compile time of the sb library sb_t_info.compile_time
Definition: cs_sb.h:327
SbError Refresh(int gpu_info)
Refresh the sb library information
String version_str
String of the version of the sb library. sb_t_info.version_str
Definition: cs_sb.h:317
String compile_date
String of the compile date of the sb library. sb_t_info.compile_date
Definition: cs_sb.h:322
SbError
Enum error codes
Definition: cs_common.h:13
SB Namespace
Definition: cs_common.h:3