Example #1
0
        static void Main(string[] args)
        {
            Source.Hello();
            Compile.Hello();
            Dirry.InitAltDrives();
            Instruction.Init();
            MKL.Version("Wendicka Project - WASM_Main.cs", "20.03.01");
            MKL.Lic("Wendicka Project - WASM_Main.cs", "GNU General Public License 3");
            Console.WriteLine($"Wendicka Assembler {MKL.Newest} - (c) {MKL.CYear(2020)} Jeroen P. Broks\n");
            if (args.Length == 0)
            {
                Console.WriteLine("Usage: WASM [options] <File>");
                TrickyDebug.AttachWait();
                return;
            }
            var parse = new FlagParse(args);

            parse.CrBool("s", false);
            parse.Parse();
            Silence = parse.GetBool("s");
            foreach (string f in parse.Args)
            {
                Compile.Go(Dirry.AD(f).Replace("\\", "/"));
            }
            Console.WriteLine($"\tErrors: {Errors}; Warnings: {Warnings}");
            TrickyDebug.AttachWait();
        }
Example #2
0
 public void EraseAll()
 {
     lock (Mutex)
     {
         foreach (var item in Stacks)
         {
             if (item.Value != null)
             {
                 foreach (var arr in item.Value)
                 {
                     if (this.Device.Type == DeviceType.NvidiaGPU)
                     {
                         CudaManagement.SetDevice(this.Device.ID);
                         CudaManagement.Free(arr.Ptr);
                     }
                     else if (this.Device.Type == DeviceType.Host)
                     {
                         GC.RemoveMemoryPressure((long)item.Key);
                         MKL.MKL_free(arr.Ptr);
                     }
                     else
                     {
                         throw new Exception("Uknown Device in ArrayPool!");
                     }
                 }
                 item.Value.Clear();
             }
         }
         Stacks.Clear();
     }
 }
Example #3
0
 public JCR6_WAD()
 {
     MKL.Version("JCR6 - WAD.cs", "19.03.27");
     MKL.Lic("JCR6 - WAD.cs", "ZLib License");
     name = "Where's All the Data?";
     JCR6.FileDrivers["WAD"] = this;
 }
Example #4
0
 static public void Init()
 {
     //System.Console.WriteLine("DEBUG: ZLIB INIT!!!");
     JCR6.CompDrivers["zlib"] = new JCR6_zlib(true);
     MKL.Lic("JCR6 - zlib.cs", "ZLib License");
     MKL.Version("JCR6 - zlib.cs", "21.03.09");
 }
Example #5
0
        public void *Rent(long length, long unitlength)
        {
            lock (Mutex)
            {
                UnreturnedArrayCount++;

                length *= unitlength;
                if (Stacks.ContainsKey(length) && (Stacks[length] is Stack <PointerArray> x) && x.Count > 0)
                {
                    PointerArray sr = x.Pop();
                    return(sr.Ptr);
                }
                else
                {
                    if (this.Device.Type == DeviceType.NvidiaGPU)
                    {
                        GC.AddMemoryPressure(length);
                        CudaManagement.SetDevice(this.Device.ID);
                        return(CudaManagement.Allocate(length, Device.ID));
                    }
                    else if (this.Device.Type == DeviceType.Host)
                    {
                        GC.AddMemoryPressure(length);
                        return(MKL.MKL_malloc(length, 32));
                    }
                    else
                    {
                        throw new Exception("Uknown Device in ArrayPool!");
                    }
                }
            }
        }
Example #6
0
 void Header()
 {
     QCol.Yellow("Alternate Directory\t");
     QCol.Cyan($"Version {MKL.Newest}\n");
     QCol.Magenta($"Coded and copyrighted {MKL.CYear(2019)} by: Jeroen P. Broks\n");
     QCol.Green("Licensed and released under terms of the GPL 3\n\n");
 }
Example #7
0
 static void Init()
 {
     MKL.Lic("NJCR - NJCR.cs", "GNU General Public License 3");
     MKL.Version("NJCR - NJCR.cs", "21.03.09");
     JCR6_lzma.Init();
     JCR6_zlib.Init();
     JCR6_jxsrcca.Init();
     JCR_JCR5.Init();
     JCR6_JXSDA.Init();
     new JCR6_WAD();
     new JCR_QuakePack();
     new JCR_a();
     new JCR_QuickLink();
     new JCR_WestwoodPAK();
     Dirry.InitAltDrives();
     Register("ADD", new F_Add());
     Register("DELETE", new F_Delete());
     Register("EXTRACT", new F_Extract());
     Register("TYPE", new F_Type());
     Register("HEX", new F_HEX());
     {
         var V = new F_Verbose();
         Register("VIEW", V);
         Register("LIST", V);
         Register("VERBOSE", V);
     }
     Register("SHOW", new F_Show());
     Register("SCRIPT", new F_Script());
     Register("SUPPORT", new F_Support());
     //Register("QUHELP", new F_QU_Help());
     QCol.DoingTab = 20;
 }
Example #8
0
 static JCR6()
 {
     MKL.Version("JCR6 - jcr6.cs", "18.09.30");
     MKL.Lic("JCR6 - jcr6.cs", "Mozilla Public License 2.0");
     CompDrivers["Store"] = new TJCRCStore();
     FileDrivers["JCR6"]  = new TJCR6DRIVER();
 }
Example #9
0
 public JCR_QuakePack()
 {
     MKL.Version("JCR6 - QuakePAK.cs", "19.03.27");
     MKL.Lic("JCR6 - QuakePAK.cs", "ZLib License");
     JCR6.FileDrivers["Quake PAK"] = this;
     name = "Quake PAK";
 }
Example #10
0
        public MainWindow()
        {
            try {
                InitializeComponent();
                MKL.Version("Stach - MainWindow.xaml.cs", "22.05.21");
                MKL.Lic("Stach - MainWindow.xaml.cs", "GNU General Public License 3");
                Title            = $"Stach - (c) {MKL.CYear(2020)} Jeroen P. Broks";
                ExampleSwap.Text = Core.Config[Platform, "ExampleSwap"];
                foreach (string ad in Dirry.AltDriveList)
                {
                    List_System.Items.Add(ad);
                }
                var startd = Directory.GetCurrentDirectory().Replace('\\', '/');
                RegisterEntryFields();
                Core.IN_Resource = false;
                Core.CDirectory  = startd;
                UpdateDirBox();
                RenewUsed();
                RenewFavs();
                ViewNothing();
            } catch (Exception e) {
#if DEBUG
                Confirm.Annoy($"{e}\n\n{e.StackTrace}\n\nI will try to continue, but expect things NOT to go so well!", "Start up error!", System.Windows.Forms.MessageBoxIcon.Error);
#else
                Confirm.Annoy($"{e.Message}\n\nI will try to continue, but expect things NOT to go so well!", "Start up error!", System.Windows.Forms.MessageBoxIcon.Error);
#endif
            } finally {
                AutoConfigUpdate = true;
            }
        }
Example #11
0
 internal static void Init()
 {
     MKL.Lic("Wendicka Project - Instruction.cs", "GNU General Public License 3");
     MKL.Version("Wendicka Project - Instruction.cs", "20.03.09");
     Set("end", new Instruction(0, delegate(Source.Line l) { return(l.Parameters.Length == 0); }));
     Set("call", new Instruction(1, delegate(Source.Line l) {
         //var ret = true;
         var p = l.Parameters;
         if (p.Length == 0)
         {
             WASM_Main.VP("\nNothing to call"); return(false);
         }
         System.Diagnostics.Debug.WriteLine($"Checking call! Total parameters {p.Length}");
         if (p[0].Kind != Source.DataKind.API && p[0].Kind != Source.DataKind.Chunk && p[0].Kind != Source.DataKind.GlobalVar && p[0].Kind != Source.DataKind.LocalVar)
         {
             WASM_Main.Error($"Uncallable call: {p[0].Kind}"); return(false);
         }
         return(true);
     }));
     Set("invoke", new Instruction(2, Get("call").Check));
     Set("defer", new Instruction(3, Get("call").Check));
     Set("resume", new Instruction(4, delegate { throw new Exception("resume after yield not yet implemented"); }));
     Set("return", new Instruction(5));
     Set("yield", new Instruction(6));
 }
Example #12
0
 public JCR_a()
 {
     MKL.Version("JCR6 - a.cs", "20.01.20");
     MKL.Lic("JCR6 - a.cs", "ZLib License");
     JCR6.FileDrivers["AR"]      = this;
     JCR6.FileDrivers["AR"].name = "The Archiver";
 }
Example #13
0
 static void Head()
 {
     QCol.Yellow("Quick Neil ");
     QCol.Cyan($"{MKL.Newest}\n");
     QCol.Green($"(c) Jeroen P. Broks {MKL.CYear(2020)}\n");
     QCol.Magenta("Released under the terms of the GPL3\n\n");
 }
Example #14
0
 public void MklCallsWork()
 {
     if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
     {
         Assert.IsTrue(MKL.MKL_GetMaxThreads() == Environment.ProcessorCount || MKL.MKL_GetMaxThreads() == Environment.ProcessorCount / 2);
     }
 }
Example #15
0
 static public void Init()
 {
     InitDone = true;
     MKL.Lic("Stach - KittyViewer.cs", "GNU General Public License 3");
     MKL.Version("Stach - KittyViewer.cs", "21.03.09");
     Debug.WriteLine("Init Kitty Source View Drivers");
     KittyHigh.Init();
     new KittyBlitzMax();
     new KittyHighBASIC();
     new KittyHighBlitzBasic();
     new KittyHighBrainFuck();
     new KittyHighC();
     new KittyHighCobra();
     new KittyHighCS();
     new KittyHighGINI();
     new KittyHighGo();
     new KittyHighHtml();
     new KittyHighINI();
     new KittyHighJava();
     new KittyHighJavaScript();
     new KittyHighJSON();
     new KittyHighLua();
     new KittyHighNeil();
     new KittyHighNIL();
     new KittyHighPascal();
     new KittyHighPython();
     new KittyHighSASKIA();
     new KittyHighScyndi();
     new KittyHighVB();
     new KittyHighWhiteSpace();
     new KittyHighXml();
     //new KittyNiks();
 }
Example #16
0
        public static Tensor AddBias(this Session session, Tensor x, Tensor b)
        {
            int mb = x.Axes[0];             // number of items in a mini-batch

            if (mb == 1)
            {
                return(session.Add(x, b));
            }

            Tensor y = session.Allocate("addBias", x.Axes);

            int stride = x.Strides[0];      // item length

            Debug.Assert(stride == b.Length, "Biases tensor has invalid size.");

            // repeat for each item in mini-batch
            for (int i = 0, off = 0; i < mb; i++, off += stride)
            {
                Mathematics.Add(stride, x.Weights, off, b.Weights, 0, y.Weights, off);
            }

            if (session.CalculateGradients && (x.CalculateGradient || b.CalculateGradient))
            {
                session.Push(() =>
                {
                    Tensor dy = session.GetGradient(y);

                    // dx += dy
                    if (x.CalculateGradient)
                    {
                        Tensor dx = session.GetGradient(x);
                        lock (dx)
                        {
                            dx.Add(dy);
                        }
                    }

                    // db += sum(dy)
                    if (b.CalculateGradient)
                    {
                        float[] ones = new float[mb];
                        MKL.Set(mb, 1.0f, ones, 0);

                        Tensor db = session.GetGradient(b);
                        lock (db)
                        {
                            MKL.MxV(MatrixLayout.ColumnMajor, stride, mb, y.Gradient, 0, false, ones, 0, db.Weights, 0, false);

                            /*for (int i = 0, off = 0; i < mb; i++, off += stride)
                             * {
                             *  Mathematics.Add(stride, y.Gradient, off, db.Weights, 0);
                             * }*/
                        }
                    }
                });
            }

            return(y);
        }
Example #17
0
        public static void Init()
        {
            MKL.Lic("Development Log - GUI.cs", "GNU General Public License 3");
            MKL.Version("Development Log - GUI.cs", "21.08.28");
            Application.Init();
            win = new MainWindow();
            win.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 0));
            win.SetSizeRequest(1200, 800);
            win.Resizable = false;
            win.Title     = $"Development log - version {MKL.Newest} - Coded by: Tricky";
            Tabber        = new Notebook(); Tabber.SetSizeRequest(1000, 770);
            Tabber.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 20));
            Console          = new TextView();
            Console.Editable = false;
            Console.ModifyFont(Pango.FontDescription.FromString("Courier 18"));
            Console.SizeAllocated += new SizeAllocatedHandler(ConsoleDOWN);
            Prompt = new Entry();
            var overlord  = new VBox();
            var superior  = new HBox();
            var sidebar   = new VBox(); sidebar.SetSizeRequest(200, 770);
            var mainarea  = new VBox();
            var cscroll   = new ScrolledWindow();
            var promptbar = new HBox();

            InitSidebar(sidebar);
            win.Add(overlord);
            overlord.Add(superior); superior.SetSizeRequest(1200, 600);
            overlord.Add(cscroll); cscroll.SetSizeRequest(1200, 170); cscroll.Add(Console);
            overlord.Add(promptbar); promptbar.SetSizeRequest(1200, 30); promptbar.Add(Prompt);
            var pOk = new Button("Ok");

            pOk.SetSizeRequest(50, 30);
            pOk.Clicked      += AndACTION;
            Prompt.Activated += AndACTION;
            Prompt.SetSizeRequest(1150, 30);
            promptbar.Add(pOk);
            Console.ModifyBase(StateType.Normal, new Gdk.Color(0, 20, 0));
            Console.ModifyText(StateType.Normal, new Gdk.Color(0, 255, 0));
            Prompt.ModifyBase(StateType.Normal, new Gdk.Color(25, 18, 0));
            Prompt.ModifyText(StateType.Normal, new Gdk.Color(255, 180, 0));
            superior.Add(sidebar);
            superior.Add(mainarea);
            mainarea.Add(Tabber);
            GeneralInit(NewTab("General"));
            TagsInit(NewTab("Tags"));
            InitEntries(NewTab("Entries"));
            InitPrefix(NewTab("AutoPrefix"));
            InitHistory(NewTab("Command History"));
            WriteLn("Welcome to Devlog!");
            WriteLn("Coded by: Tricky");
            WriteLn($"(c) 2016-20{qstr.Left(MKL.Newest,2)} Jeroen P. Broks");
            WriteLn("Released under the terms of the General Public License v3\n");
            AutoEnable();
//#if KEYDEBUG
            //WriteLn("KEYDEBUG is set!");
            //Prompt.KeyPressEvent += KeyDebug;
            //Prompt.KeyPressEvent += StoreProperty;
//#endif
        }
Example #18
0
            private static Tensor __ones(Tensor t)
            {
                switch (t.dtype)
                {
                case torch.float16:
                {
                    MKL.Full(t.__half, 1);
                    return(t);
                }

                case torch.float32:
                {
                    MKL.Full(t.__float, 1);
                    return(t);
                }

                case torch.float64:
                {
                    MKL.Full(t.__double, 1);
                    return(t);
                }

                case torch.int8:
                {
                    MKL.Full(t.__int8, 1);
                    return(t);
                }

                case torch.uint8:
                {
                    MKL.Full(t.__uint8, 1);
                    return(t);
                }

                case torch.int16:
                {
                    MKL.Full(t.__int16, 1);
                    return(t);
                }

                case torch.int32:
                {
                    MKL.Full(t.__int32, 1);
                    return(t);
                }

                case torch.int64:
                {
                    MKL.Full(t.__int64, 1);
                    return(t);
                }

                case torch.@bool:
                {
                    throw new TorchException("TorchException: torch.randn is not implemented for bool tensors.");
                }
                }
                return(t);
            }
Example #19
0
 public void set_callback_function(MKL m, SWIGTYPE_p_f_p_shogun__CMKL_p_q_const__double_q_const__double__bool cb)
 {
     modshogunPINVOKE.SVM_set_callback_function(swigCPtr, MKL.getCPtr(m), SWIGTYPE_p_f_p_shogun__CMKL_p_q_const__double_q_const__double__bool.getCPtr(cb));
     if (modshogunPINVOKE.SWIGPendingException.Pending)
     {
         throw modshogunPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Example #20
0
 static public void Init()
 {
     //System.Console.WriteLine("DEBUG: ZLIB INIT!!!");
     JCR6.CompDrivers["jxsda"] = new JCR6_JXSDA(true);
     MKL.Lic("JCR6 - jcr_jxsda.cs", "ZLib License");
     MKL.Version("JCR6 - jcr_jxsda.cs", "21.07.05");
     //JXSDA.Verbose = true;
 }
Example #21
0
 static void Heading()
 {
     MKL.Version("QuickNIL - QuickNIL.cs", "19.08.31");
     MKL.Lic("QuickNIL - QuickNIL.cs", "GNU General Public License 3");
     Console.WriteLine($"QuickNIL v{MKL.Newest}");
     Console.WriteLine($"(c) Jeroen P. Broks {MKL.CYear(2019)}");
     Console.WriteLine($"Released under the terms of the GPL3\n");
 }
 public MainWindow()
 {
     MKL.Version("TeddyBear - MainWindow.xaml.cs", "19.03.16");
     MKL.Lic("TeddyBear - MainWindow.xaml.cs", "GNU General Public License 3");
     InitializeComponent();
     MessageBox.Show("This wizard will create only a very simplistic project. If you want TeddyBear to have more power than this wizard can provide, please seek out the Wiki pages on GitHub on what you all can do", "TeddyWizard");
     copyright.Content = $"(c) {MKL.CYear(2019)} Jeroen P. Broks, Licensed under the terms of the GPL3";
 }
Example #23
0
 void Header()
 {
     MKL.Version("Kthura for C# - KthuraExport.cs", "19.04.24");
     MKL.Lic("Kthura for C# - KthuraExport.cs", "GNU General Public License 3");
     Red($"Kthura Exporter {MKL.Newest}\t");
     Magenta($"Built: {BuildDate.sBuildDate}\n");
     Yellow("Coded by: ");
     Cyan("Jeroen P. Broks\n\n");
 }
Example #24
0
    public static bool perform_mkl_step_helper(MKL mkl, SWIGTYPE_p_double sumw, double suma)
    {
        bool ret = modshogunPINVOKE.MKL_perform_mkl_step_helper(MKL.getCPtr(mkl), SWIGTYPE_p_double.getCPtr(sumw), suma);

        if (modshogunPINVOKE.SWIGPendingException.Pending)
        {
            throw modshogunPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Example #25
0
        static MainClass()
        {
            MKL.Version("MyData For C# - Main.cs", "21.02.09");
            MKL.Lic("MyData For C# - Main.cs", "GNU General Public License 3");
            new JCR6_WAD();
            new JCR6_lzma();
            var rd = new JCR6_RealDir(); rd.automerge = false;

            new JCR_QuakePack();
        }
Example #26
0
 public static void Init(bool doit = true)
 {
     if (doit)
     {
         MKL.Version("JCR6 - JCR5.cs", "18.09.30");
         MKL.Lic("JCR6 - JCR5.cs", "ZLib License");
         JCR6.FileDrivers["JCR5"]      = new JCR_JCR5();
         JCR6.FileDrivers["JCR5"].name = "JCR5";
     }
 }
Example #27
0
 void HelpScreen()
 {
     Header();
     QCol.Red("Usage: "); QCol.Yellow(qstr.StripDir(qstr.StripExt(MKL.MyExe))); QCol.Magenta(" [<switches>] "); QCol.Cyan("[<files/folder>]\n\n");
     QCol.Cyan("-p\t"); QCol.Yellow("Page based output\n");
     QCol.Cyan("-all\t"); QCol.Yellow("List all found files, regardless of them being hidden or not (Hidden in Unix terms, so starting with a .)\n");
     QCol.Cyan("-ansi\t"); QCol.Yellow("Use ANSI in stead of standard Windows Console colors (default on non-Windows systems)\n");
     QCol.Cyan("-w\t"); QCol.Yellow("Wide view\n");
     QCol.Cyan("-s\t"); QCol.Yellow("Recursive\n");
     QCol.Cyan("-b\t"); QCol.Yellow("Show file names only without any info\n\n");
     QCol.Green($"{MKL.All()}\n\n");
 }
Example #28
0
        static void Head()
        {
            QCol.Yellow("NJCR ");
            QCol.Cyan($"{MKL.Newest}");
#if DEBUG
            QCol.Red("\tDEBUG BUILD!");
#endif
            Console.WriteLine();
            QCol.Magenta($"(c) Copyright Jeroen P. Broks {MKL.CYear(2019)}\n");
            QCol.Green("Released under the terms of the GPL3\n\n");
            Debug.WriteLine(Directory.GetCurrentDirectory());
        }
Example #29
0
 static Program()
 {
     MKL.Lic("Wendicka Project - Program.cs", "GNU General Public License 3");
     MKL.Version("Wendicka Project - Program.cs", "20.03.10");
     WRT.Hello();
     qstr.Hello();
     QuickStream.Hello();
     GINI.Hello();
     FileList.Hello();
     GINIE.Hello();
     MKL.AllWidth = 60;
 }
Example #30
0
        public static void Main(string[] args)
        {
            MKL.Version("ScenLang - Creation Wizard - ScenLangCreate.cs", "18.10.23");
            MKL.Lic("ScenLang - Creation Wizard - ScenLangCreate.cs", "GNU General Public License 3");
            JCR6_lzma.Init();
            Application.Init();
            MainWindow win = new MainWindow();

            win.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 25));
            win.Title = "ScenLang Creator - version " + MKL.Newest;
            win.SetSizeRequest(1000, 500);
            var mainbox = new HBox(); win.Add(mainbox);

            mainbox.SetSizeRequest(400, 500);
            var mascot = new Image();

            mascot.SetAlignment(0, 1);
            mainbox.Add(mascot);
            LoadMascot(mascot);
            mascot.SetSizeRequest(400, 500);
            workbox = new VBox(); mainbox.Add(workbox);
            workbox.SetSizeRequest(600, 500);
            AddEntry("Project", "Project directory:", true);
            AddEntry("Author", "Author:");
            AddEntry("License", "License:");
            var langbox = new HBox();

            langbox.SetSizeRequest(600, 380);
            var langlabel = new Label("Laguages:\n(Put every language on a new line)");

            langlabel.SetSizeRequest(300, 380);
            langlabel.SetAlignment(0, 0);
            langlabel.ModifyFg(StateType.Normal, new Gdk.Color(255, 255, 0));
            var scroll = new ScrolledWindow();

            Languages = new TextView();
            scroll.Add(Languages);
            scroll.SetSizeRequest(300, 380);
            Languages.ModifyBase(StateType.Normal, new Gdk.Color(0, 18, 25));
            Languages.ModifyText(StateType.Normal, new Gdk.Color(0, 180, 255));
            langbox.Add(langlabel);
            langbox.Add(scroll);
            workbox.Add(langbox);
            var finbox  = new HBox();
            var goforit = new Button("Create Project");

            finbox.Add(new HBox());
            finbox.Add(goforit);
            goforit.Clicked += OnGoForIt;
            workbox.Add(finbox);
            win.ShowAll();
            Application.Run();
        }
Example #31
0
 public static bool perform_mkl_step_helper(MKL mkl, SWIGTYPE_p_double sumw, double suma) {
   bool ret = modshogunPINVOKE.MKL_perform_mkl_step_helper(MKL.getCPtr(mkl), SWIGTYPE_p_double.getCPtr(sumw), suma);
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Example #32
0
 internal static HandleRef getCPtr(MKL obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Example #33
0
 public void set_callback_function(MKL m, SWIGTYPE_p_f_p_shogun__CMKL_p_q_const__double_q_const__double__bool cb) {
   modshogunPINVOKE.SVM_set_callback_function(swigCPtr, MKL.getCPtr(m), SWIGTYPE_p_f_p_shogun__CMKL_p_q_const__double_q_const__double__bool.getCPtr(cb));
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
 }