static void Main(string[] args) { Context context = new Context(); List<Song> songs = new List<Song>(); songs = FindSongs(context, "Andrew Peters"); if (songs.Count != 0) { Console.WriteLine(songs[0].Name); } }
static List<Song> FindSongs(Context context, string SingerName) { var rezult = context.Songs.Where(e => e.Singer.Name == SingerName); return rezult.OrderBy(e => e.Name).ToArray().ToList(); }
public void Setup() { ErrorCode error; Platform[] platforms = Cl.GetPlatformIDs(out error); List<Device> devicesList = new List<Device>(); CheckErr(error, "Cl.GetPlatformIDs"); foreach (Platform platform in platforms) { //ToDO:Log Platform Device Name; // status = clGetPlatformInfo(platform, CL_PLATFORM_NAME, sizeof(pbuff), pbuff, NULL); // status = clGetPlatformInfo(platform, CL_PLATFORM_VERSION, sizeof(pbuff), pbuff, NULL); // status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices); //ToDO: Saved the compiled version so it can be built the next time as a binary: //ToDO: Enable certain cards, fan control, scheduling string platformName = Cl.GetPlatformInfo(platform, PlatformInfo.Name, out error).ToString(); Console.WriteLine("Platform: " + platformName); CheckErr(error, "Cl.GetPlatformInfo"); //We will be looking only for GPU devices foreach (OpenCL.Net.Device device in Cl.GetDeviceIDs(platform, DeviceType.Gpu, out error)) { CheckErr(error, "Cl.GetDeviceIDs"); Console.WriteLine("Device: " + device.ToString()); devicesList.Add(device); } } if (devicesList.Count <= 0) { Console.WriteLine("No devices found."); return; } _device = devicesList[0]; if (Cl.GetDeviceInfo(_device, OpenCL.Net.DeviceInfo.ImageSupport, out error).CastTo<OpenCL.Net.Bool>() == OpenCL.Net.Bool.False) { Console.WriteLine("No image support."); return; } _context = Cl.CreateContext(null, 1, new[] { _device }, ContextNotify, IntPtr.Zero, out error); //Second parameter is amount of devices CheckErr(error, "Cl.CreateContext"); }